首页 > 解决方案 > Windows Git-bash 致命:无法从远程存储库读取。通过 ssh 推送时

问题描述

我正在使用 Windows Git-bash 使用 ssh(不是 https)推送到我的存储库。我已按照此页面中的说明进行操作

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

$ ssh-keygen -t rsa -b 4096 -C "barghouti_since88@hotmail.com"
$ ssh-add ~/.ssh/id_rsa

然后复制 ~/.ssh/id_rsa 中的密钥,并按照此设置将其复制到我在 github 帐户中的 ssh 密钥

https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

但是现在当我尝试使用

$git add file
$git commit -m "adding file"
$git push

我得到以下

FATAL ERROR: Couldn't agree a key exchange algorithm (available: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521)
fatal: Could not read from remote repository.

请确保您具有正确的访问权限并且存储库存在。

标签: windowsgitgithubsshgit-bash

解决方案


您可以检查几种可能性:

  • 您是否使用“https”而不是“git”“git clone”了存储库?如果要使用 ssh 进行 git push,则还需要使用 ssh 进行克隆。
  • 你的 Git for Windows 版本够新吗?每隔一段时间,GitHub 就会删除对旧的、较弱的加密货币的支持,并且您的软件需要匹配服务器的算法,在这种情况下它没有匹配错误消息。
  • 你使用与 git 相同的 ssh 软件吗?Git for Windows 附带了 ssh,但 ssh 也可以单独安装,例如作为 OpenSSH 单独安装,或者包含在 putty 中。将 'where ssh-keygen' 的输出与环境变量 GIT_SSH 进行比较。

希望这可以帮助


推荐阅读