GitHub: Permission denied (publickey). 问题解决方法

之前一直用https来push到github上, 今天试了下用ssh, 把origin改为ssh地址后, 用git push -u origin master出现错误:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

上网搜了一下, 原因是'You've probably not added a public key to your SSH keys.'

解决方法如下:

用下面的命令生成public key

$ ssh-keygen -t rsa

复制 public key (id_rsa.pub) 到你账户的 list of SSH keys, 再重新push.


参考:

http://stackoverflow.com/questions/14967621/fatal-the-remote-end-hung-up-unexpectedly

http://stackoverflow.com/questions/15240815/git-fatal-the-remote-end-hung-up-unexpectedly
阅读更多
换一批

github报错Permission denied (publickey),求帮助

11-15

错误代码如下:rn[code=text]rn$ ssh -vT xxx@github.com -i zzmgithub_dsarnOpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007rnWarning: Identity file zzmgithub_dsa not accessible: No such file or directory.rndebug1: Reading configuration data /c/WINDOWS/system32/config/systemprofile/.sshrn/configrndebug1: Applying options for github.comrndebug1: Connecting to github.com [207.97.227.239] port 22.rndebug1: Connection established.rndebug1: identity file /c/WINDOWS/system32/config/systemprofile/.ssh/zzmgithub_dsrna type -1rndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debiarnn-6+squeeze1+github8rndebug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github8 pat OpenSSH*rndebug1: Enabling compatibility mode for protocol 2.0rndebug1: Local version string SSH-2.0-OpenSSH_4.6rndebug1: SSH2_MSG_KEXINIT sentrndebug1: SSH2_MSG_KEXINIT receivedrndebug1: kex: server->client aes128-cbc hmac-md5 nonerndebug1: kex: client->server aes128-cbc hmac-md5 nonerndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentrndebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPrndebug1: SSH2_MSG_KEX_DH_GEX_INIT sentrndebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYrndebug1: Host 'github.com' is known and matches the RSA host key.rndebug1: Found key in /c/WINDOWS/system32/config/systemprofile/.ssh/known_hosts:1rnrndebug1: ssh_rsa_verify: signature correctrndebug1: SSH2_MSG_NEWKEYS sentrndebug1: expecting SSH2_MSG_NEWKEYSrndebug1: SSH2_MSG_NEWKEYS receivedrndebug1: SSH2_MSG_SERVICE_REQUEST sentrndebug1: SSH2_MSG_SERVICE_ACCEPT receivedrndebug1: Authentications that can continue: publickeyrndebug1: Next authentication method: publickeyrndebug1: Offering public key: C:\\Documents and Settings\\Administrator\\.ssh\\idrn_rsarndebug1: Authentications that can continue: publickeyrndebug1: Trying private key: /c/WINDOWS/system32/config/systemprofile/.ssh/zzmgitrnhub_dsarndebug1: PEM_read_PrivateKey failedrndebug1: read PEM private key done: type rnEnter passphrase for key '/c/WINDOWS/system32/config/systemprofile/.ssh/zzmgithurnb_dsa':rndebug1: read PEM private key done: type RSArndebug1: Authentications that can continue: publickeyrndebug1: No more authentication methods to try.rnPermission denied (publickey).rn[/code]rnrnpassphrase 是正确的,这个没有问题,不知道哪里出问题了。。。。

没有更多推荐了,返回首页