GitLab post-receive hook not firing

Posted by Ben Graham on Server Fault See other posts from Server Fault or by Ben Graham
Published on 2012-10-02T08:19:32Z Indexed on 2012/10/02 9:39 UTC
Read the original article Hit count: 312

Filed under:

Apologies if this isn't the right stackexchange.

I have a GitLab install. It was installed over the top of a gitolite install that was only a few days old, and I assume this non-standard setup is at the root of my problem, but I cannot pin it down.

The problem is straightforward: post-receive hooks are not fired. This prevents 'project activity' appearing in GitLab. The problem looks like:

$ git push
#...
error: cannot run hooks/post-receive: No such file or directory

Hook Exists

The post-receive hook/symlink exists and is executable:

-rwxr-xr-x 1 git git 470 Oct  3  2012 .gitolite/hooks/common/post-receive
lrwxrwxrwx 1 git git  45 Oct  3  2012 repositories/project.git/hooks/post-receive -> /home/git/.gitolite/hooks/common/post-receive

It's Executable By GitLab

The gitlab user can execute the script (I have removed the /dev/null redirect and fed in blank input to get an 'OK' as output):

sudo su - gitlab -c /home/git/.gitolite/hooks/common/post-receive

OK

GitLab Can Find It

GitLab is looking for hooks in the correct location:

$ grep hooks /srv/gitlab/gitlab/config/gitlab.yml
  hooks_path: /home/git/.gitolite/hooks/

and

$ bundle exec rake gitlab:app:status RAILS_ENV=production
# ...
/home/git/.gitolite/hooks/common/post-receive exists? ............YES

Environment

The env -i line in the hook is commonly cited as an issue. I think that would occur after this problem, but for completeness, redis-cli is found OK:

$ env -i redis-cli
redis>

I've run out of debugging ideas on this one. Does anybody have any suggestions?

© Server Fault or respective owner

Related posts about git