我在python中创建了一个小的pre-commit
钩子。这个钩子就像Linux下的一个魅力,但在Windows中,它不断告诉我:git无法执行python脚本作为钩子
error: cannot spawn .git/hooks/pre-commit: No such file or directory
我知道有一直在这里类似的问题同一个问题,结论接缝是家当。我的脚本有此上的第一行:
#!F:\PortableApps\PortablePython3.2\App\python.exe
这也是有趣的是,仅仅通过写.git/hooks/pre-commit
执行脚本作品精彩,但只要我尝试提交,git的吐出上述消息。
另一个有趣的事情是,当我的编码转换从ANSI为UTF-8(使用记事本+ +),我在尝试执行脚本时出现以下错误:
.git/hooks/pre-commit: Cannot execute binary file
我使用以下工具:
- PortablePython 3.2.1.1
- msysgit 1.7.6(便携式)
可能的重复[我怎么能得到我的git(windows上的msysgit)post-commit脚本来调用我的python脚本而不是bash?](http:// stackoverflow。com/questions/1547005 @ how-can-i-get-my-git-msysgit-on-windows-post-commit-script-to-invoke-my-python) – Amber 2012-02-16 09:02:25
@Amber使用bash脚本作为包装器调用'python.exe pre-commit.py'工作。但是,有没有Python版本? – 2012-02-16 09:15:45