Adding a Git hook to a Gitolite repository

Adding a local Git hook to a Gitolite managed repository is easy. As you would expect those hooks are managed by Git, also.

Imagine a configuration snippet like this in gitolite.conf:

repo    datenkollektiv/blog
    RW+     =   @blogger

To add a post-receive hook simply create a file in local/hooks/datenkollektiv/blog/ named post-receive.


echo publishing blog

git --git-dir=${BLOG_HOME}/.git --work-tree=${BLOG_HOME} status
git --git-dir=${BLOG_HOME}/.git --work-tree=${BLOG_HOME} pull -f
cd ${BLOG_HOME} && make publish

echo blog updated.

Enjoy the result here: blog. That's it.

Ever needed to debug your Gitolite rights?

$ ssh git@git-server
PTY allocation request failed on channel 0
hello dilbert, this is git@git-server running gitolite3 (Debian) on git 1.9.1

R W testing
Show Comments