我在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