一切福田,不離方寸,從心而覓,感無不通。

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

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

[plain] view plain copy

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

from:http://blog.csdn.net/xzz_hust/article/details/8969090