2

I'm trying to set up my first Git Repository on GitHub. I've been following the documentation on GitHub's website here. I get everything right up until the very last command: git push -u origin master. It gives me the following error:

FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
fatal: The remote end hung up unexpectedly

I have no idea what this means. This is the only output I get that differs from what the documentation indicates. I can't seem to find anything online that has this same error and explains what it means and just as importantly what I need to do to fix it. I'm hoping to put up a sweet Java Helper Library, so any help would be greatly appreciated!

kentcdodds
  • 27,113
  • 32
  • 108
  • 187

1 Answers1

7

The error message tells you that you cannot connect properly.

Try logging into GitHub with the following command:

$ ssh -T git@github.com

Maybe you have forgotten to make your SSH key known using ssh-add path/to/key?

To do so, use the following code (which avoids the "Could not open a connection to your authentication agent." problem):

$ exec ssh-agent bash
bash$ ssh-add /path/to/key

See the GitHub docs over at http://help.github.com/ssh-issues/ to resolve the SSH issues.

On Windows, use openssh as "GitHub only provides support for openssh.", it is available here: http://sshwindows.sourceforge.net/

cfedermann
  • 3,286
  • 19
  • 24
  • Thanks for the answer. I did try `ssh -T git@github.com`. I did that again and then tried `push` and that gave the same result. Then I tried `ssh-add path/to/key` and that gave me a "Could not open a connection to your authentication agent.` I'll look at that link and let you know. Thanks – kentcdodds Apr 13 '12 at 20:14
  • I just uninstalled PuTTY and I'm trying to decide whether to install Tortoise or reinstall PuTTY because I need plink.exe (whatever that is) to authenticate my SSH. Which do you recommend? It looks like using PuTTY is kind of a hack job, is that right? – kentcdodds Apr 13 '12 at 20:37
  • See http://help.github.com/win-set-up-git/ -- "Do not use PuTTY if you are given the option. GitHub only provides support for openssh." – cfedermann Apr 13 '12 at 20:40
  • I've uninstalled and re-installed git several times and it doesn't give me the option to choose openssh and I can't find where to change that. I'm afraid the first time I installed git I may have selected PuTTY and now I can't seem to change it. Do you have any idea how I might change that? I can't find anything online. – kentcdodds Apr 13 '12 at 21:31
  • I'm now getting an error message like this: `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: The remote end hung up unexpectedly` – kentcdodds Apr 13 '12 at 21:35
  • The problem is that the server's host key is not yet known in your local key registry. Hence, for security reasons, OpenSSH abandons the connection. Try ssh git@github.com again and say "yes" when asked if you want to accept the server's fingerprint. – cfedermann Apr 14 '12 at 05:58
  • thanks for the comment. I tried what you said and it didn't seem to change anything unfortunately. It seems like my question was answered and this is a new issue. Please follow the issue here: http://stackoverflow.com/questions/10166173/git-servers-host-key-not-cached-in-registry-github-com – kentcdodds Apr 15 '12 at 21:15