我的 post commit 钩子在 git 之后没有运行。如果我只是从终端运行它,我已经验证了该钩子确实有效。钩子里的代码是:
#!/bin/sh
#.git/hooks/post-commit
# An example hook script that is called after a successful
# commit is made.
#
# To enable this hook, rename this file to "post-commit".
perl -pi -e 's/([a-f0-9]+)$/'$( git rev-parse HEAD )/ ../../config/commit.git
我确实在 ./.git/hooks/ 中将文件重命名为 post-commit,并且权限是-rwxr-x-r-x
所以我不确定为什么它不起作用。