mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-15 04:17:01 -05:00
commit diff email notifications #620
Open
opened 2025-11-02 03:30:30 -06:00 by GiteaMirror
·
29 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16.0
v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2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#620
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @monnier on GitHub (Apr 7, 2017).
I cannot find any way to configure Gitea to send the diffs of every commit via email (so this is probably a feature request).
[x]):https://try.gitea.io!@strk commented on GitHub (Apr 7, 2017):
Git itself usually comes with scripts you can invoke from the update hook
@monnier commented on GitHub (Apr 7, 2017):
But AFAIK this requires access to the Git hooks, which implies pretty much the ability to run arbitrary code as the Gitea user, so it can only be setup by the admin, basically.
@strk commented on GitHub (Apr 7, 2017):
Yes, that's the case.
Another option is setting up webhooks to ping an external service
to do the mailing.
@monnier commented on GitHub (Apr 7, 2017):
Using a webhook is pretty painful, tho: it requires setting up a web service tha responds to those requests by going back to the repository (or "git fecthing" into its local copy) and redoing the work. Compared to using the Git post-receive hook, this sounds like a nightmare.
@stale[bot] commented on GitHub (Feb 16, 2019):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
@monnier commented on GitHub (Feb 16, 2019):
Any news on this front?
@lafriks commented on GitHub (Feb 16, 2019):
Noone is working on this currently
@stale[bot] commented on GitHub (Apr 17, 2019):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
@monnier commented on GitHub (Apr 17, 2019):
Still hoping...
@ptman commented on GitHub (Apr 17, 2019):
sr.ht might have a more email-friendly approach
@ivptr commented on GitHub (Sep 30, 2021):
Wondering how to get email notifications for commits, containing author's details and code diffs?
They should be sent to all members having access to repository.
@cbrake commented on GitHub (Sep 30, 2021):
one way to do a little better is open up pull requests, then I think commits on the PR branch trigger email notifications, but may not show diffs.
@ivptr commented on GitHub (Sep 30, 2021):
Until this is incorporated into Gitea itself, https://github.com/git-multimail/git-multimail can be used via post-receive hook.
Here is the config to be inserted in https://github.com/git-multimail/git-multimail/blob/master/git-multimail/post-receive.example:
It still needs email addresses of all users having access to repository (collaborators, owners and its team members) per feature request #17199, to use it in multimailhook.mailingList above.
Also would be nice to use full name of user in user.name field per feature request #17198.
@wxiaoguang commented on GitHub (Oct 1, 2021):
What is the purpose of "sending the diffs of every commit via email"?
The diff can be large, hard to read, and maybe working-in-progress. I can not think about a real use case for it.
@ocomsoft commented on GitHub (Oct 1, 2021):
@wxiaoguang As a manager I get an email for every commit - if the commit message is of interest I can view the email and see pretty quickly what has been done and make sure the developer is on the right track. I would find this very useful. We use a git service at the moment that does this for us and use gitea as a backup (and it has a better UI) but this is the one feature I am missing. You are tight sometimes they are hard to read and large but more of the time the commits are small and I think this feature is VERY useful.
@wxiaoguang commented on GitHub (Oct 1, 2021):
If you focus on commit messages, how about webooks?
@ocomsoft commented on GitHub (Oct 1, 2021):
@wxiaoguang These don't let me review the code - correct me if I am wrong. I want to see the code in my Email so I can do a quick review.
@cbrake commented on GitHub (Oct 1, 2021):
If you watch the repo:
And then for every commit, make it on a pull request:
git switch -C my-branchgit pushThen anyone watching the repo will get emails like:
I highly recommend the PR flow -- it is a much better way to work with Git than everyone just pushing to master. It provides:
The code diff is not in the email, but you can easily click on the link to view the code diff if you are interested.
I've also found commit diffs in emails useful in the past, so I think that would be a useful feature to add to gitea. Obviously, for large diffs, you would want to limit the amount in the email, but most changes (if done properly) are small and easily reviewed in an email. This is the way patches on OSS mail lists have worked for years.
@ivptr commented on GitHub (Oct 2, 2021):
We are a small team and need to be notified on every commit and see a diff right away. This is extremely useful to quickly see what's going on.
Here are instructions how to achieve this using git_multimail and post-receive git hook:
https://github.com/git-multimail/git-multimail/blob/master/git-multimail/git_multimail.py
https://github.com/git-multimail/git-multimail/blob/master/git-multimail/post-receive.example
Rename post-receive.example to git_multimail-post-receive
Assign execute permission to both git_multimail.py and git_multimail-post-receive
Edit git_multimail-post-receive and add the following after
config = git_multimail.Config('multimailhook'):On each commit you will get email like this:
The only thing still needed are email addresses of all users having access to repository (collaborators, owners and its team members) per feature request #17199, to be used instead of GITEA_PUSHER_EMAIL in multimailhook.mailingList key above.
@strk commented on GitHub (Oct 5, 2021):
In case it is helpful: we're using git hooks to send emails
(I think via multimail but not sure).
Works fine for us, except for the fact that you have to install it
separately and have "superpowers" to setup the hook...
@flucrezia commented on GitHub (Nov 7, 2022):
Hi, @ivptr, I'm trying your steps to setup emails with details inside the body for each commit.
However, I'm not able to receive any email. I'm using the Docker setup with bind mounted volume for data/, can this be a problem?
Or do you have any idea? I don't see any errors from gitea app logs.
I'm pushing on master and the symlink inside the docker container seems OK (I have created the link inside the Docker container of Gitea in order to have the correct relative path).
Thank you very much.
@ivptr commented on GitHub (Nov 7, 2022):
Haven't tried with Docker, sorry.
Maybe scripts are not being executed at all or there is some other issue.
What happens when you run
./git_multimail.py? It should display "No email recipients configured!".When run
./git_multimail-post-receivenothing should happen, then just press Enter, it should return to the prompt.@flucrezia commented on GitHub (Nov 7, 2022):
Thank you for the quick reply, I have found indeed python was not installed on the container.
The env variables: GITEA_PUSHER_NAME, GITEA_PUSHER_EMAIL, GITEA_REPO_NAME, GITEA_REPO_USER_NAME...Are they defined by gitea automatically? Or should I define them? Because currently they are not exported within the container.
Thank you very much.
@lunny commented on GitHub (Nov 8, 2022):
I think we can at least send the email with an attched patch file.
@ivptr commented on GitHub (Nov 8, 2022):
Gitea provides such env variables when calling the hook.
@flucrezia commented on GitHub (Nov 8, 2022):
Ok, I finally managed to make it work also on Gitea container. I report here in case could be useful for someone else. This follows ivptr setup instructions.
apk add python3ln -s /usr/bin/python3 /usr/bin/pythongit_multimail-post-receiveinside the.../post-receive.d/directory of the interested repogit_multimail.pyinto/usr/lib/python3.10to make it available as a modulemultimailhook.from=sameassmtpenvelopesender@domain.comOne scenario in which this turns out to be useful is when Gitea is reachable only from a private network, so it is not possible to jump from the email to Gitea outside that network.
@adamel commented on GitHub (Feb 22, 2023):
This would be a very welcome change for us.
I would like the full commit contents of the PR to be sent to any user added as a pull request reviewer.
@DaLynX commented on GitHub (Aug 15, 2024):
I'm interested in this feature too.
@adamel commented on GitHub (Mar 12, 2025):
Just FYI we ended upp doing this and it wasn't that painful actually - you can fetch all the commits of a pull request in git patch format using a single request to the Gitea, and more or less all meta data about the repository and PR is available in the POST-data of the webhook call.