问题
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!
回答1:
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/
来源:https://stackoverflow.com/questions/10147521/setting-up-repo-on-github-error-on-push-u-origin-master