How to setup an automated git email notifier server
(1)
sudo wget http://git.icir.org/git-notifier.git/blob_plain/refs/heads/master:/git-notifier -O /usr/share/git-core/contrib/hooks/git-notifier chmod +x /usr/share/git-core/contrib/hooks/git-notifier
(2) Add ssh private key to your .shh folder so git operations dont ask for password. This will be automated.
(3) For each new repo, do this :
git clone ${url}
add this to .git/config
[hooks]
mailinglist = mysuperemail@gmail.com
showrev = "git show -C %s; echo"
emailprefix = "[git]"
Like this :
echo -e "[hooks]\n\tmailinglist = mysuperemail@gmail.com\n\temailprefix = \"[git]\"" >> .git/config
copy this file to .git/hooks/post-receive
#!/bin/sh
GIT_DIR=/home/dev/ems/.git
GIT_WORK_TREE=/home/dev/ems
/usr/share/git-core/contrib/hooks/git-notifier
chmod ug+x .git/hooks/post-receive
|
(4) Add a cronjob to do this
5 * * * * dev cd /repo/dir; git pull; .git/hooks/post-receive
Troubleshooting
If you get during cronjob
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Solution
Recent Comments