简体   繁体   English

为什么在git hook中执行git命令会使其余的钩子脚本无法完成?

[英]Why does executing a git command in a git hook stop the rest of the hook script from finishing?

I put the line exec git --git-dir /home/gcom370p/stu013/express/.git pull /home/gcom370p/stu013/express.git master in the middle of my hook script, and that line executes just fine, but anything after it doesn't execute any more. 我将exec git --git-dir /home/gcom370p/stu013/express/.git pull /home/gcom370p/stu013/express.git master放在钩子脚本的中间,该行执行得很好,但是之后不再执行任何操作。

This is my post-receive hook script: http://pastie.org/3574320 这是我的接收后挂钩脚本: http : //pastie.org/3574320

Any idea why? 知道为什么吗?

exec replaces the currently executing process with whatever it runs. exec用当前运行的进程替换当前正在执行的进程。 You don't want that. 你不要那样 Just put the command without exec in front of it. 只需将没有exec的命令放在命令前面即可。 It'll still run the command, it just won't replace the shell itself. 它仍然会运行命令,只是不会替换外壳本身。

git --git-dir /home/gcom370p/stu013/express/.git pull /home/gcom370p/stu013/express.git master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM