gpt4 book ai didi

hook - Gitlab 预提交钩子(Hook)

转载 作者:行者123 更新时间:2023-12-05 00:36:17 35 4
gpt4 key购买 nike

我想在 gitlab 中使用预提交钩子(Hook)。我做的一切都像文档中一样:https://docs.gitlab.com/ce/administration/custom_hooks.html

在 custom_hooks 目录中,我创建了包含以下内容的预提交文件:

#!/bin/bash

exit 1

钩子(Hook)永远不会被触发,因为我可以提交。

当我对预接收 Hook 做同样的事情时 - 一切都很好。

如果 Gitlab 不允许使用预提交 Hook ?

最佳答案

Customizing Git - Git Hooks 中所述, 客户端钩子(Hook)不会在服务器上使用。
我之前解释了为什么不能在克隆中包含钩子(Hook):

  • "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 , 你可以 set custom Git Hooks用于服务器端钩子(Hook)。

    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

    关于hook - Gitlab 预提交钩子(Hook),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39786724/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com