How to set up git email notifications

This is not very well documented in the git user manual. Here is what I did:

Go to your central repository, not your working copy. There, change to the hooks directory:

cd /path/to/yourproject/hooks
cp post-receive.sample post-receive

If your repo is not a bare repository, you have to change to .git/hooks to do this. The post-receive-email script can be found under contrib/hooks/ in the git documentation (e.g. in /usr/share/doc/git/contrib/hooks on most Linux distributions).
Now configure the email hook:

git config hooks.mailinglist “email1@bla.com, email2@bla.com”
git config hooks.envelopesender yourname@informatik.rwth-aachen.de
git config hooks.emailprefix “New commit: “

Also you should give your project a name:

$EDITOR /path/to/yourproject/description

Leave a Reply

Your email address will not be published.