GitLab 自定义钩子未执行

GitLab 自定义钩子未执行

我在本地服务器上运行 GitLab CE 8.9.0,但自定义钩子无法运行,这让我很头疼。这里有很多类似问题,但大多数问题似乎都过时了,主要是关于原生 git 钩子,而不是 GitLab 的“自定义钩子”。我读过以下文档:GitLab但我仍然遇到类似的问题。我的设置如下:

$ 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

我可以手动运行脚本并看到预期结果:

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

知道为什么它无法运行吗?

相关内容