【问题标题】:git Connection abandoned, fatal: Could not read from remote repositorygit连接被放弃,致命:无法从远程存储库中读取
【发布时间】:2014-09-28 02:42:15
【问题描述】:

我正在尝试使用 Pageant 克隆 cygwin 或 GitBash (msysgit) 中的存储库作为 ssh 密钥。我收到以下错误:

$ git clone git@github.com:username/your-project.git
Cloning into 'your-project'...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
Connection abandoned.
fatal: Could not read from remote repository.

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

然而,当你尝试用 gitub 调试你的 ssh 连接时,它说它可以工作

$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

$ ssh-add -l 显示的指纹与我的 github 个人资料中列出的指纹相同

所以问题不是这里描述的问题:https://help.github.com/articles/error-permission-denied-publickey

【问题讨论】:

    标签: git putty plink pageant


    【解决方案1】:

    我在此页面 http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/ 上找到了解决方案,但在这里重新创建,希望将来可以节省其他人的时间,因为该页面对我来说并没有轻易出现在谷歌中。

    事实证明,为了充分利用 cygwin/msysgit 的 pageant,您首先需要使用 putty 本身接受服务器的指纹。

    只需启动 putty 并连接到主机 git@github.comgit@bitbucket.org,它就会存储该指纹。您将看到的只是一个短暂的 putty 会话,然后它就关闭了。

    现在回到 cygwin 或 msysgit 你应该可以克隆了。

    或者,如果您不想为您的密钥使用 Pageant,您必须取消设置指向 plink.exe 的环境变量 GIT_SSH 并且 cygwin / msysgit 将自行接受服务器指纹(但您不再会得到使用选美)。这是在http://sourceforge.net/p/forge/site-support/2959/#204c 发现的

    【讨论】:

    • 非常感谢您真正回来并提供答案!为什么 git on windows 文档的故事这么乱?
    • 这也是在安装 Git 扩展时让命令行 git + ssh 正常工作的技巧。您需要下载 Putty.exe(不包含在当前发行版中)并运行它。我将它放在与其他腻子工具相同的文件夹中:Program Files (x86)\Git Extensions\PuTTY
    【解决方案2】:

    将 GIT_SSH 设置为使用 TortoisePlink.exe 而不是 PuTTY 的 plink.exe。这将允许弹出对话框窗口提示输入内容(例如确认指纹或输入密码)。如果您通过 Git 使用plink.exe,则无法输入对 plink.exe 提示的响应。

    【讨论】:

      猜你喜欢
      • 2012-11-10
      • 2015-01-19
      • 1970-01-01
      • 2021-05-01
      • 2018-08-24
      • 1970-01-01
      • 2014-02-10
      • 2015-10-31
      • 2015-11-21
      相关资源
      最近更新 更多