问题
I'm really confused about how to configure a GitLab global hook. The documentation is clear about how to set a global hook. So I login in my GitLab instance, go to the directory /opt/gitlab/embedded/service/gitlab-shell/hooks
, and it has 3 files:
-rwxr-xr-x 1 root root 131 Jun 10 16:22 post-receive
-rwxr-xr-x 1 root root 131 Jun 10 16:22 pre-receive
-rwxr-xr-x 1 root root 131 Jun 10 16:22 update
All the files have the same content:
# cat pre-receive
#!/bin/sh
echo "The gitlab-shell hooks have been migrated to Gitaly, see https://gitlab.com/gitlab-org/gitaly/issues/1226"
exit 1
Since they all have a exit 1
, clearly these hooks aren't being executed anymore.
The linked issue, is really confusing. It is a roadmap to implement something called Gitaly but I really don't see how to use it to implement global Git hooks.
Does anyone can show me the step by steps configuration of a git global hook in GitLab CE edition?
回答1:
You are searching hooks inside gitlab-shell
& Since they are moving many things from gitlab-shell
to gitaly-ruby
. So that means hooks are working somewhere from gitaly.
Now try this:
ls /opt/gitlab/embedded/service/gitaly-ruby/git-hooks
Hope you wont find any exit nonzero
there. Rest is your art.
来源:https://stackoverflow.com/questions/56639251/how-to-configure-a-global-git-hook-in-gitlab-version-11-11