Git 挂钩不起作用

问题描述 投票:0回答:2

我的 git hook 似乎不起作用。即来自 gerrit 的

commit-msg
钩子。

commit-msg
钩子存在于
<repo>/.git/hooks/
中并且具有正确的语法。

git gerrit githooks
2个回答
9
投票

确保您的挂钩文件可执行。如果您使用

curl
下载挂钩,请确保您
chmod +x
它们。

$ pwd
<repo>/.git/hooks
$ chmod +x commit-msg

如果您使用

scp
来获取钩子,则
-p
标志可能会为您设置正确的模式。


0
投票

检查其他答案。可能是

core.hooksPath
已设置为
$GIT_DIR/hooks
之外的其他路径,导致该文件夹中的挂钩被忽略。

© www.soinside.com 2019 - 2024. All rights reserved.