Gitolite v3 – add email hook

I added the email hook by changing files on the git server.

gitolite@gitserver~$ cd .gitolite/hooks/common
gitolite@gitserver:~/.gitolite/hooks/common$ cp /usr/share/doc/git/contrib/hooks/post-receive-email post-receive
gitolite@gitserver:~/.gitolite/hooks/common$ $HOME/bin/gitolite setup --hooks-only
gitolite@gitserver:~/.gitolite/hooks/common$ cd
gitolite@gitserver:~$ vi .gitolite.rc

For the git server that’s all for the changes needed.

Now, where you have the gitolite-admin directory:

In the conf/gitolite.conf

In the repository you want to have the email add the following

config hooks.mailinglist = ""
config hooks.emailprefix = '[repo_name] '


repo test1
RW+     =   mfang @admin
R       =   @staff
config hooks.mailinglist = ""
config hooks.emailprefix = "[test1]"

It sends out email using SSMTP:

To setup edit /etc/ssmtp/ssmtp.conf

To Test:
In test1, edit something.

git commit # git commit -a -m 'message'
git push # git push origin master

It took me a little while to remember that I needed to push to have the email sent.

According to a stackoverflow article you can add the email hook from the client gitolite-admin directory also. Haven’t tried it.
LongYi Qi – very helpful for Gitolite v3. Instruction to setup ssmtp too
HaveTheKnowHow – used this to configure my ssmtp

This entry was posted in Git and tagged , , , . Bookmark the permalink.

2 Responses to Gitolite v3 – add email hook

  1. Be sure to make post-receive executable. i.e. chmod ugo+x post-receive

  2. Pingback: Libre Experience » Gitolite setup and configuration

Leave a Reply to Troy Anderson Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s