Git’s Native eMail Notifier
From the repository you wish to send email on commits.
cd .git/hooks mv post-receive post-receive.bkp ln -s /usr/share/git-core/contrib/hooks/post-receive-email post-receive git config hooks.mailinglist "mailinglist@example.com" git config hooks.emailprefix "[SUBJECT PREFIX] " # note the trailing space
Git Commit Notifier
This ‘plugin’ will allow you to send an email every time a commit is committed to the repository. You may use this on the central repository to keep everyone following the project up to date.
- The source may also be downloaded at http://github.com/bitboxer/git-commit-notifier
To use this plugin, you first need to compile the script, then add the config information to each repository you wish to use it on.
To Install Git Commit Notifier
On Fedora 12 you first need to install Ruby and a few other dependences. After you download the needed dependences, you may compile the script.
yum install ruby rubygems hpricot rubygem-hpricott gem install git-commit-notifier
To Configure Git Commit Notifier
In your repository’s .git/hooks folder or if it’s a “bare” repository, just the hooks folder. Create a file named post-receive with the following content.
#!/bin/sh git-commit-notifier ../git-commit-notifier.yml
Once you have saved the file, you need to make it executable.
chmod 775 post-receive
After you have made the hook executable, check up one directory to the repository’s .git directory. From here you need to create and modify your git-commit-notifier’s config file. Start out by creating a file named git-commit-notifier.yml, and copy the below config to it.
Git Commit Notifier Config File
# The recipient for the commit: mailinglist: developers@example.com # set to true if you want to ignore empty merge messages ignore_merge: false # Optional parameter for the subject-line of the mail # emailprefix: GIT # Decorate files with link to a webview. Possible values: none or gitweb link_files: none # select the delivery method: smtp or sendmail delivery_method: sendmail # settings for the smtp server smtp_server: address: localhost port: 25 domain: localhost user_name: user@localhost password: password authentication: plain enable_tls: false # settings for sendmail sendmail_options: location: /usr/sbin/sendmail arguments: -i -t # If link_files is set to "gitweb", you need to configure the path to your gitweb # instance and the project name. gitweb: path: http://developerserver/path_to_gitweb project: test.git
Is it possible to set git-commit-notifier to send emails only for certain branch ?
No, I don’t think you can do that the way it sits.