- Ruby 1.9
gem install sinatra
- git-notifier (master branch required)
cp gitdub /path/to/dir/in/$PATH
cp config.yml.example config.yml
- Navigate to a repository you own, e.g.,
- Click on Settings on the top-right corner
- Click on Service Hooks in the left sidebar
- Select the first service WebHook URLs
- Enter the URL to reach gitdub, e.g.,
- Click Update Settings to save your changes
- Click again on WebHook URLs
- Click Test Hook to let github initialize your repository
The YAML configuration file contains the list of
repositories that gitdub tracks. The first section (
gitdub:) specifies global
options, such as the interfaces gitdub should bind to and ports to listen on.
Moreover, you can control the behavior of the first chunk of data. When setting
silent_init: to true, gitdub will only fast-forward to the current commit and
begin mailing diffs after the next push (or after hitting the Test Hook
button). Otherwise gitdub sends exactly one email per commit since the first
commit in the repository.
The second section (
notifier:) describes the behavior of git-notifier. Here you
can the configure a global sender of the emails (
from:), the receivers
to:), and the prefix of the email subject (
The third section (
github:) contains a list of github repository entries,
where each entry must at least contain an
id field. If an item does not
contain any further options, the globals from the
notifier section apply.
However, in most cases it makes sense to override the globals with
repository-specific information, e.g.:
notifier: # The email sender. (Can be overriden for each repository.) from: 'Sam Sender <email@example.com>' # The email subject prefix. (Can be overriden for each repository.) subject: '[git]' github: - id: mavam/gitdub subject: '[git/gitdub]' # Overrides global '[git]' subject prefix. from: firstname.lastname@example.org # Overrides global sender. to: [email@example.com] # Overrides global receivers. - id: mavam/.* from: mavam # Overrides global sender.
Note the regular expression in the second entry. This enables the configuration
of entire sets of repositories. Since gitdub processes the list sequentially in
order of definition, only settings from the first match apply. For example,
appending an entry for
mavam/foo would never match.
To prevent unauthorized access to the service, you can restrict the set of allowed source IP addresses to github addresses, e.g., via iptables:
iptables -A INPUT -m state --state NEW -m tcp -p tcp \ -s 188.8.131.52,184.108.40.206,220.127.116.11 --dport 42042 -j ACCEPT
If that's not an option on your machine, you can also perform application-layer filtering in gitdub by setting the following configuration option:
allowed_sources: [18.104.22.168, 22.214.171.124, 126.96.36.199]
Gitdub comes with a BSD license, please see COPYING for details.