[英]Git server side hooks commit update file
I am trying to implement git hook commit on a server using these instructions: https://git-scm.com/book/be/v2/Customizing-Git-An-Example-Git-Enforced-Policy 我正在尝试使用以下指令在服务器上实现git hook commit: https : //git-scm.com/book/be/v2/Customizing-Git-An-Example-Git-Enforced-Policy
I created file "update" (make it executable, put in hooks folder), and found that this file is not executed when I do git commit -m "my message"
and git push
- all these commands work perfectly, but 'update' file is not working (I tried with simple script "echo "Hello World" >> somefile.txt) 我创建了文件“ update”(使其可执行,放在hooks文件夹中),并发现当我执行
git commit -m "my message"
和git push
时,该文件未执行-所有这些命令都可以正常工作,但是“ update”文件不起作用(我尝试使用简单的脚本“ echo“ Hello World” >> somefile.txt)
Where is the problem? 问题出在哪儿?
As commented above, the update
hook is a server side hook 如上所述,
update
挂钩是服务器端挂钩
It needs to be on the server you are pushing to, in the bare repo: repo.git/hook/update
它必须在您要推送到的服务器上,位于裸
repo.git/hook/update
: repo.git/hook/update
That explains why a git commit
(local operation) does not trigger the server side hook. 这就解释了为什么
git commit
(本地操作)不会触发服务器端挂钩。
For the rest, see the follow-up question . 有关其他信息,请参见后续问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.