繁体   English   中英

无法在 WSL 中使用 git。 C:\Windows\System32\OpenSSH\ssh.exe:未找到

[英]Unable to use git in WSL. C:\Windows\System32\OpenSSH\ssh.exe: not found

所以我在 Windows 10 上,不久前我决定使用 WSL,这样我就可以得到 zsh。 但是,现在我不能再从我的 wsl 终端使用 git,即我不能再从远程git pull 当我尝试时,我得到以下...

'C:\Windows\System32\OpenSSH\ssh.exe': 1: C:\Windows\System32\OpenSSH\ssh.exe: not found
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

此类操作在 bash 和GitHub Desktop中运行良好。 为什么 WSL 试图从 Windows 使用 OpenSSH 它应该是 Linux 对吗?

我正在努力寻找有关此问题的信息,因此非常感谢您的帮助。 如果我可以提供更多信息,请告诉我。

像这样更改值“core.sshCommand”后我得到了同样的错误:

git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"

在我的文件 ~/.gitconfig 中,我禁用了如下换行符:

#[core]
#       sshCommand = 'C:\\Windows\\System32\\OpenSSH\\ssh.exe'

然后,当您在 git 存储库中时,如果您有同样的问题,请检查您的 my-project/.git/config 文件,如果有新配置,请按上述方式禁用它。

就我而言,它有效:-)
祝你今天过得愉快

仔细检查您是否有指向C:\Windows\System32\OpenSSH\ssh.exe的环境变量GIT_SSH :这在 WSL session 中不是有效路径。

取消设置。
之后,它取决于使用的 Windows 10(1709?1809?20H1?...),以及使用的 WSL(WSL1 还是 WSL2?)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM