如何在GitLab中添加服务器端的预接收钩子? [英] how to add the pre-receive hook in server side in GitLab?

查看:1087
本文介绍了如何在GitLab中添加服务器端的预接收钩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图限制二进制文件(EXE,DLL,PDF)在我们的gitlab中提交。所以我需要添加钩子来限制它在全局。我怎样才能做到这一点? Pre-receive hook是否适合这个?

I am trying to restrict the binary file (EXE, DLL, PDF) committing in our gitlab. So I need to add the hook to restrict it in globally. How can I do this? Is Pre-receive hook is suitable for this?

这个地方是否正确添加钩子?

Is this place is correct to add the hook?


/ opt / gitlab / embedded / service / gitlab-shell / hooks / pre-receive

/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive

不胜感激!

推荐答案

正如我评论的,对于每个项目,使用自定义挂钩:( Chained钩子支持

请参阅如何将钩子添加到gitlab?中的确切步骤? a>,并涉及创建一个专用 repo.git / custom_hooks 子文件夹。

As I commented, for per-project, use custom hooks: (Chained hooks support)
See the exact steps at "How can I add hooks to gitlab?", and involve the create of a dedicate repo.git/custom_hooks subfolder.

但是, -repository,不适用于所有回购。

您需要为每个回购组添加该脚本。

But that is per-repository, not for all repos.
You would need to add that script for each repo of a group.

pre-receive 脚本你会看到在正常的 repo.git / hooks 文件夹实际上是符号链接到 gitlab -shell hook 文件夹,它由GitLab管理访问权限。

The pre-receive script you would see in the normal repo.git/hooks folder is actually a symlink to the gitlab-shell hook folder, and it is taken by GitLab to manage the access permission.

这篇关于如何在GitLab中添加服务器端的预接收钩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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