« Previous | Next»

Sending a email notification when pusing to git (sourceforge)

Posted by coldtobi | 18 Sep, 2010, 13:12

Whenever I push changes to solarpowerlog, I want that a notification mail is sent to a dedicated mailing list.

However, the documentation on sourceforge just says "you can do this", but finding docs about "how" is hard. 

So this is my try to document the procedure, in case this helps someone... The examples are the one for solarpowerlog, so be sure to edit them before applying.

 

  • Backup your repository. The method using rsync worked fine for me (See here for instructions).
Example. Do in a newly created directory:
$ rsync -av solarpowerlog.git.sourceforge.net::gitroot/solarpowerlog/* .
  • Create and connect the shell service, as described here
$ ssh -t coldtobi,solarpowerlog@shell.sourceforge.net create
Requesting a new shell for "coldtobi" and waiting for it to start.
queued... creating... starting...

This is an interactive shell created for user coldtobi,solarpowerlog.
Use the "timeleft" command to see how much time remains before shutdown.
Use the "shutdown" command to destroy the shell before the time limit.
For path information and login help, type "sf-help".

  • Now you are dropped to a shell, allowing you to modify very low-level. So be cautionous to avoid needing that backup. Lets enter the scm directrory and retrieve the post-receive-email script. Finally, make it executeable
[coldtobi@shell-22005 ~]$ cd /home/scm_git/s/so/solarpowerlog/solarpowerlog/hooks
[coldtobi@shell-22005 hooks]$ wget 'http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/hooks/post-receive-email' -nv -O post-receive
2010-09-18 11:32:28 URL:http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/hooks/post-receive-email [20679] -> "post-receive" [1] [coldtobi@shell-22005 hooks]$ chmod +x post-receive
  • Configure git. You can directly edit the config file or use the git config command.
[coldtobi@shell-22005 solarpowerlog]$ git config --add hooks.mailinglist 'solarpowerlog_commits@lists.sourceforge.net'
[coldtobi@shell-22005 solarpowerlog]$ git config --add hooks.announce-list 'solarpowerlog_users@lists.sourceforge.net'
That's it.  now you can leave the interactive shell (use shutdown to clear your shell)

_ASIP_

Linux / Debian, solarpowerlog | Comments (0) | Trackbacks (0)

Related Articles:

0 Comments | "Sending a email notification when pusing to git (sourceforge)" »