![](/img/trans.png)
[英]msysgit error with hooks: "git error: cannot spawn .git/hooks/post-commit: No such file or directory"
[英]Git for Windows, setting GIT_SSH to a shell file causes causes “error: cannot spawn <path>: No such file or directory”
在Windows 10
,如果執行以下操作,請使用Git-2.4.6-5th-release-candidate-64-bit.exe
:
set GIT_SSH=D:\ssh.sh
我得到:
error: cannot spawn D:\ssh.sh: No such file or directory
fatal: unable to fork
但是,如果我改為:
set GIT_SSH=D:\ssh.exe
要么:
set GIT_SSH=D:\ssh.bat
一切都按預期進行。
我的PATHEXT
:
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.sh
已應用的注冊表文件:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe]
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe\shell]
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe\shell\open]
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe\shell\open\command]
@="\"C:\\sdk\\Git\\bin\\bash.exe\" \"%1\" %*"
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe]
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe\shell]
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe\shell\open]
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe\shell\open\command]
@="\"C:\\sdk\\Git\\bin\\sh.exe\" \"%1\" %*"
[HKEY_CLASSES_ROOT\sh_auto_file]
[HKEY_CLASSES_ROOT\sh_auto_file\shell]
[HKEY_CLASSES_ROOT\sh_auto_file\shell\open]
[HKEY_CLASSES_ROOT\sh_auto_file\shell\open\command]
@="\"C:\\sdk\\Git\\bin\\sh.exe\" \"%1\" %*"
[HKEY_CLASSES_ROOT\sh_auto_file\ShellEx]
[HKEY_CLASSES_ROOT\.sh]
@="sh_auto_file"
[HKEY_CLASSES_ROOT\.sh\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,36,\
00,38,00,00,00
[HKEY_CLASSES_ROOT\.sh\shell\edit]
[HKEY_CLASSES_ROOT\.sh\shell\edit\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""
這些的結果是,如果我打開cmd
並輸入:
D:\ssh.sh
甚至:
D:\ssh
腳本被執行。
但是git拒絕使用shell腳本,但滿足於使用.exe
文件和.bat
文件。
為什么是這樣? 是一個錯誤,還是我缺少了什么?
由於某些完全無法解釋的原因,我可以驗證它現在在cmd
和git bash
中都可以運行,而以前卻沒有。
現在開始為ssh創建git-repo預處理程序,以便多帳戶用戶更輕松。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.