如何在GitLab版本11.11中配置全局git钩子? [英] How to configure a global git hook in GitLab version 11.11?

查看:911
本文介绍了如何在GitLab版本11.11中配置全局git钩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对如何配置GitLab全局钩子感到非常困惑.该文档对于

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

由于它们都具有exit 1,因此显然这些钩子不再执行了.

Since they all have a exit 1, clearly these hooks aren't being executed anymore.

链接的问题确实令人困惑.这是实施名为 Gitaly 的路线图,但我真的不知道如何使用它来实现全局Git挂钩.

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.

任何人都可以向我展示GitLab CE版中git全局钩子的逐步配置吗?

Does anyone can show me the step by steps configuration of a git global hook in GitLab CE edition?

推荐答案

您正在搜索gitlab-shell&由于他们将许多东西从gitlab-shell转移到gitaly-ruby.因此,这意味着钩子在gitaly的某个地方起作用.

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.

现在尝试:

ls /opt/gitlab/embedded/service/gitaly-ruby/git-hooks

希望您在那里找不到任何exit nonzero.休息是你的艺术.

Hope you wont find any exit nonzero there. Rest is your art.

这篇关于如何在GitLab版本11.11中配置全局git钩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆