git push是报Permission denied (publickey)错误解决

今天晕了半天了,搞了个git工程到github上,以为很简单,因为之前也弄过,那知道搞了大半天都搞不好,一直报如下错误

D:\javawork\ee-0.0.1-SNAPSHOT>git push -u origin master
Warning: Permanently added the RSA host key for IP address '192.30.252.130' to t
he list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

查看了官网说明

https://help.github.com/articles/generating-ssh-keys/

主要是如下几步骤

1 ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

2 ssh-agent -s

3 ssh-add ~/.ssh/id_rsa

4 再把公钥加入到github网站上去

 

但就卡在第3步了,ssh-add ~/.ssh/id_rsa这个一直执行不成功

报Permission denied (publickey).

 

找了很多资料,有说要ssh-agent bash

有说ssh-agent
       ssh-add ~/.ssh/id_key

 

都不行,最后看到一片文章

http://blog.csdn.net/wswqiang/article/details/7200022

大概意思要使用windows Git 版本,试了下,还真行,在windows Git上不用执行ssh-add,即可git push成功

自此,问题解决。

posted @ 2015-07-24 14:31  李涛军  阅读(2194)  评论(0编辑  收藏  举报