How to configure a global git hook in GitLab version 11.11?

梦想与她 提交于 2019-12-23 04:55:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!