问题现象:
从 github 克隆代码或者推送仓库的时候提示如下错误信息:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
解决方法:
只是其中的一种,我遇到的是这种解决方法:
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"
环境:
系统:windows 11
shell: PowerShell
备注:
我试了重新生成 ssh 的密钥,还有通过 ssh 链接 github 都是正常的,测试命令如下:
ssh -T git@github.com
返回如下:
Hi liu-shichao! You've successfully authenticated, but GitHub does not provide shell access.
说明 ssh 配置是正确的,碰巧看到了上边那种解决方法,顺利解决了,可能是之前用过别的 git 工具修改过这个配置。