error: cannot spawn D:\Program Files (86)\Git\usr\bin\ssh.exe: No such file or directory
原创
2017-12-02
java

发现问题

升级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,路径的变更,导致以前设置的路径失效,修改正确即可。