Monday, April 18, 2011

Configure Git Commit Email

1. Verify sendmail is installed
2. Execute the following git commands on the repo sending the email notification. Note: some of these config settings may be superfluous.
$ git config --global sendemail.smtpserver yourmailserver.com
$ git config --global sendemail.smtpserverport 25
$ git config --global sendmail.to youremail@address.com
$ git config --global user.name "BFI GIT"
$ git config --global user.email git@bfi.com
$ git config --global sendemail.smtpuser
$ git config --global sendemail.smtppass
$ git config --global hooks.mailinglist yourmailinglist@address.com
$ git config --global hooks.envelopesender whothisis@from.com
$ git config --global hooks.emailprefix [GIT]

3. In the /hooks directory of your bare repository (.git/hooks in a non-bare repo) copy/rename post-receive.sample to post-receive.

4. Edit post-receive and add the following line (your path to post-receive-email may be different)
. /usr/share/doc/git/contrib/hooks/post-receive-email

5. Edit the description file in your repo (.git/description in a non-bare repo) and replace the text with the name of your project. The text in the description file will show up in the subject line of the commit email.

No comments:

Post a Comment