Search code examples
gitputtyplinkpageant

git Connection abandoned, fatal: Could not read from remote repository


I'm trying to clone a repo in either cygwin or GitBash (msysgit) using Pageant for ssh keys. I get the following error:

$ git clone [email protected]: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.

Yet when trying to debug your ssh connection with gitub it says it works

$ ssh -T [email protected]
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.

And $ ssh-add -l show the same finger print that is listed in my github profile

So the problem is not the one described here: https://help.github.com/articles/error-permission-denied-publickey


Solution

  • I found the solution on this page http://www.bitsandpix.com/entry/git-setup-msysgit-install-with-pageantplink-from-putty/ but re-creating here in hopes it saves someone else time in the future as that page did not show up in google for me easily.

    It turns out in order to fully use pageant with cygwin/msysgit you first need to accept the finger print of the server with putty itself.

    Simply launch putty and connect to host [email protected] or [email protected] and it will store that fingerprint. All you will see is a brief flash of a putty session and then it closes.

    Now back in cygwin or msysgit you should be able to clone.

    Alternatively, if you do not wish to use Pageant for your keys you must unset the environment variable GIT_SSH which points to plink.exe and cygwin / msysgit will accept the server fingerprint on their own (but you no longer will get to use Pageant). This was discovered at http://sourceforge.net/p/forge/site-support/2959/#204c