Search code examples
gitgitolite

gitolite add repo specific post-receive hook


I am trying to add a post-receive hook for specific repositories using this doc: http://gitolite.com/gitolite/cookbook.html

In my gitolite-admin repo I added local/hooks/repo-specific/deploy (which as of now just trys to touch a file) and added the line option hook.post-receive = deploy in conf/gitolite.conf.

On my server I looked up .gitolite.rc which initially didn't contain a %RC block. So I tried to just add one to it:

%RC = (
    ENABLE => ['repo-specific-hooks'],
    LOCAL_CODE =>  "$rc{GL_ADMIN_BASE}/local"
);

After pushing changes to the repo with the hook I receive this error:

remote:                 ***** ABORTING *****
remote:         can't make head or tail of 'option hook.post-receive = deploy'

This is the first time I am using gitolite, so I might very well be missing something obvious. Anybody any ideas?


Solution

  • You are using Gitolite V2.x. Repo-specific hooks are only supported since V3.6.

    Are you using Debian? Then, you probably installed the gitolite package from apt. This is not what you want. Version 3 is (at least for Debian, Ubuntu and the like) installed with package gitolite3.

    This is because V3 is not strictly compatible with V2. If you need to upgrade Gitolite, there is a tutorial at http://gitolite.com/gitolite/migr.html.