2

I have GitLab CE 8.9.0 running on a local server but I'm having trouble with the custom hooks not running. There's no lack of questions here with similar issues, however the large majority appear to be out of date, mostly regarding native git hooks and not GitLab's "custom hooks". I've read the documentation from GitLab but am still having similar issues. My set up looks like this:

$ pwd
/var/opt/gitlab/git-data/repositories/[redacted]/[redacted].git
$ ls -l custom_hooks/
total 4
-rwxr-xr-x 1 git git 127 Jun 22 13:15 post-receive
$ cat custom_hooks/post-receive
#!/bin/sh
git --work-tree=/var/www/html/~dev/[redacted] --git-dir=/var/opt/gitlab/git-data/repositories/[redacted]/[redacted].git checkout -f

I'm able to run the script manually and see the expected results:

$ whoami
git
$ pwd
/var/opt/gitlab/git-data/repositories/[redacted]/[redacted].git/custom_hooks
$ ./post-receive
$

Any ideas of why it's not running?

MLeon
  • 21
  • 1
  • Maybe it is permission problem? Did you check if the the user the gitlab process is using can execute the hook? – Henrik Pingel Jun 23 '16 at 21:20
  • If I understand how gitlab works (which I may be wrong), it's executed by the user "git". If I'm right, then yes it's executing properly as shown in the second code block. – MLeon Jun 24 '16 at 05:53
  • It's either an issue with the script or the permissions, because a simplified echo into the tmp folder works properly. Thanks @knowhy – MLeon Jun 24 '16 at 06:40

0 Answers0