1. 程式人生 > >error: cannot spawn D:\Program Files (86)\Git\usr\bin\ssh.exe: No such file or directory

error: cannot spawn D:\Program Files (86)\Git\usr\bin\ssh.exe: No such file or directory

發現問題

升級git之後,提交程式碼報瞭如下的錯誤。

git.exe pull --progress -v --no-rebase “origin” master
error: cannot spawn D:\Program Files (86)\Git\usr\bin\ssh.exe: No such file or directory
fatal: unable to fork
git did not exit cleanly (exit code 1) (109 ms @ 2018/9/28 10:13:46)

根據提示,是找不到ssh.exe,根據 這個網址

發現瞭如下回到回答。

Following Git with SSH on Windows, you see that GIT_SSH should reference the ssh executable, not just its path:
(old msysgit)
set GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe
(new 2015 git for Windows)
set GIT_SSH=C:\Program Files\Git\usr\bin\ssh.exe

然後我去 某盤:Program Files\Git\usr\bin\ssh.exe 果然找到了ssh.exe。

解決

我的是 TortoiseGit 客戶端有問題,
找到 Settings -> Network -> 右側的ssh client -> 點選 Browser,選擇正確的路徑

總結

升級git,路徑的變更,導致以前設定的路徑失效,修改正確即可。