Gitlab 预提交挂钩
Gitlab pre-commit hook
我想在 gitlab 中使用预提交挂钩。我做的一切都像文档中的那样:https://docs.gitlab.com/ce/administration/custom_hooks.html
在 custom_hooks 目录中,我创建了包含以下内容的预提交文件:
#!/bin/bash
exit 1
挂钩从未触发,因为我可以提交。
当我对预接收挂钩执行相同操作时 - 一切正常。
如果 Gitlab 不允许使用预提交钩子?
如 Customizing Git - Git Hooks 中所述,不会在服务器上使用客户端挂钩。
我之前解释过为什么不能在克隆中包含钩子:
- "why it is not possible to git add .git/hooks/my-hook"
- "Any way to put my hook to github repo?"
Since GitLab 7.5, you can set custom Git Hooks 用于服务器端挂钩。
Git natively supports hooks that are executed on different actions. Examples of server-side git hooks include pre-receive, post-receive, and update
Normally, Git hooks are placed in the repository or project's hooks directory. GitLab creates a symlink from each project's hooks directory to the gitlab-shell hooks directory for ease of maintenance between gitlab-shell upgrades
我想在 gitlab 中使用预提交挂钩。我做的一切都像文档中的那样:https://docs.gitlab.com/ce/administration/custom_hooks.html
在 custom_hooks 目录中,我创建了包含以下内容的预提交文件:
#!/bin/bash
exit 1
挂钩从未触发,因为我可以提交。
当我对预接收挂钩执行相同操作时 - 一切正常。
如果 Gitlab 不允许使用预提交钩子?
如 Customizing Git - Git Hooks 中所述,不会在服务器上使用客户端挂钩。
我之前解释过为什么不能在克隆中包含钩子:
- "why it is not possible to git add .git/hooks/my-hook"
- "Any way to put my hook to github repo?"
Since GitLab 7.5, you can set custom Git Hooks 用于服务器端挂钩。
Git natively supports hooks that are executed on different actions. Examples of server-side git hooks include pre-receive, post-receive, and update
Normally, Git hooks are placed in the repository or project's hooks directory. GitLab creates a symlink from each project's hooks directory to the gitlab-shell hooks directory for ease of maintenance between gitlab-shell upgrades