带钩子的msysgit错误:“git error:can not spawn .git / hooks / post-commit:No such file or directory” [英] msysgit error with hooks: "git error: cannot spawn .git/hooks/post-commit: No such file or directory"

查看:2569
本文介绍了带钩子的msysgit错误:“git error:can not spawn .git / hooks / post-commit:No such file or directory”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使post-recieve和post-commit挂钩与msysgit(Windows 7 Pro / 32和Ultimate / 64)正常工作。对于post-commit hook,如果我从git-bash或控制台提交,我会得到上述错误,但如果我通过git-gui提交,它会正常工作。对于接收后的钩子,所有三者都会给出相同的错误。



我认为这是某种权限或路径错误,但并没有任何线索可以从这里开始。



 <$> 

c $ c>#!/ bin / sh
echo执行后提交
exit 0

这让我难住了一段时间,并且我看到加入shebang修复了它。在SVN世界中,在* nix中我们有一个pre-commit脚本,而在Windows中我们有pre-commit.bat,SVN自动在Windows中拾取bat文件。 Git似乎没有选择pre-commit.bat(或任何钩子),并将shebang添加到工作的钩子文件中。


I'm having trouble getting post-recieve and post-commit hooks to work correctly with msysgit (Windows 7 Pro/32 and Ultimate/64). For post-commit hook I get the above error if I commit from either git-bash or the console, but it works fine if I commit through git-gui. For a post-recieve hook, all three give the same error.

I'm thinking this is some sort of permission or path error, but don't really have any clue where to start here.

解决方案

Add the SHEBANG to the first line of hook, like so:

#!/bin/sh
echo "executing post-commit"
exit 0

This had me stumped for a while as well and I saw that adding the shebang fixed it. In SVN world, while in *nix we have a "pre-commit" script and in Windows we had "pre-commit.bat" and SVN automatically picked up the bat file in Windows. Git doesn't seem to pick up a pre-commit.bat ( or any hook ) and adding the shebang to the hook file worked.

这篇关于带钩子的msysgit错误:“git error:can not spawn .git / hooks / post-commit:No such file or directory”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆