Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 686
chrisan Avatar asked Aug 05 '14 12:08

chrisan


People also ask

How resolve fatal Cannot be read from remote repository?

The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.

How do I fix git GitHub Permission denied Publickey fatal could not read from remote repository?

The “Permission denied (publickey). fatal: Could not read from remote repository” error is caused by an issue with the way in which you authenticate with a Git repository. To solve this error, make sure your key is being used on your Git account. If it is not, add your key to Git.

How do I remove a remote git repository?

The git remote remove command removes a remote from a local repository. You can use the shorter git remote rm command too. The syntax for this command is: git remote rm <remote-url>. If you remove a remote accidentally, you will need to add it back manually using the git remote add command.


2 Answers

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

like image 187
chrisan Avatar answered Oct 06 '22 04:10

chrisan


Set GIT_SSH to use TortoisePlink.exe instead of PuTTY's plink.exe. This will allow for popup dialog window to prompt for things (e.g. confirm fingerprint, or enter password). If you use plink.exe through Git, you cannot type in responses to plink.exe prompts.

like image 27
konyak Avatar answered Oct 06 '22 06:10

konyak