Integrate git/gitolite server with slack

In a project I have been working due to lack of funds we have been using our own git central server and not github or bitbucket. Access control is managed by gitolite. Our team is using slack as a collaboration tool. What we would like is when a developer pushes back to our repository/repositories then every developer is notified through slack.

Thanks to Chris Eldredge and his git-slack-hook script this is possible.

Installing and configuring

Step 1 – Get the git-slack-hook script

First of all clone the git-slack-hook github repository

# git clone

I have configured gitolite to store repositories managed under /srv/gitolite/repositories. So for example you want projectA repository to integrate with slack when something is pushed there.
You need to copy the git-slack-hook in the hooks directory of the projectA repository as a post-receive hook

# cp git-slack-hook /srv/gitolite/repositories/projectA.git/hooks/post-receive
# chown gitolite:gitolite /srv/gitolite/repositories/projectA.git/hooks/post-receive
# chmod 755 /srv/gitolite/repositories/projectA.git/hooks/post-receive

Step 2 – Create the Incoming WebHook on slack

Next you need to create an Incoming WebHooks on slack. Our team uses a channel called #pull-requests so everyone is notified when something is pushed back on the repository. Visit for example and choose channel #pull-requests to post notification and Add Incoming Webhooks Integration

Screenshot from 2015-11-03 20:38:07

Get the Webhook URL which will look like and change if you d like Customize Name. I usually use git-bot there and finish by Saving Settings

Step 3 – Configure your git repository

Go to you git server and execute the following commands on your repository projectA.

# cd /srv/gitolite/repositories/projectA.git/
# git config hooks.slack.webhook-url ''
# git config '#pull-requests'
# git config hooks.slack.username 'git-bot'
# git config hooks.slack.repo-nice-name 'ProjectA Repository

and you are ready to go. Each time someone pushes back on the repository then #pull-requests channel will be notified. The best part is that you can have multiple repositories notifying the same slack channel. You just need to follow Step 3 and change the repo-nice-name.


2 thoughts on “Integrate git/gitolite server with slack

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s