git无法连接bitbucket/github时,出现"Permission deied(publickey)"

Permission denied (publickey).
fatal: Could not read from remote repository.

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

 

出现上面的错误是,可能是因为你没有使用ssh或者是bitbucket/github端没有设置对应的公钥,如何生成key具体可以参考:http://blog.aboutc.net/opensuse/37/github-bitbucket-connect-via-ssh-keys

大致步骤:

ssh-keygen -t rsa -C "[[KEY-NAME]]"  //一般使用邮箱名称

注:在win7下可能出现“Could not create directory '//.ssh'”的错误,这是由于没有指定HOME变量,添加名称为HOME,值为“C:\Users\[[用户名]]”到当前用户变量中即可

然后在复制.ssh目录下的id_rsa.pub的内容设置到bitbucket/github端的ssh keys中

然后测试:
ssh -T git@github.com

ssh -T git@bitbucket.org

简单备忘。。。
 
posted @ 2013-09-06 11:10  窅山  阅读(1285)  评论(0编辑  收藏  举报