git clone 出错 “Permission denied (publickey)” 解决办法 - Go语言中文社区

git clone 出错 “Permission denied (publickey)” 解决办法


运行命令 git clone git@github.com:robbiehanson/CocoaAsyncSocket.git 时出错如下:

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

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

解决办法:

  1. 在Git Bash输入命令: ssh-keygen -t rsa -C <添加注释,可省略>
  2. 操作成功后会在当前用户文件下面会生成一个.ssh文件夹,如:C:Usersvance.ssh,在.ssh文件夹里面有三个文件:id_rsaid_rsa.pubknown_hosts。其中id_rsa是私钥文件,id_rsa.pub是公钥文件,打开公钥文件后复制;
  3. 进入github个人设置页面,左边选择“SSH and GPG keys”,右边点击“New SSH key”,Key中粘贴刚才复制的公钥文件里面的内容,然后保存就可以正常使用git clone git@github.com:robbiehanson/CocoaAsyncSocket.git命令。

注: ssh-keygen 命令

版权声明:本文来源简书,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://www.jianshu.com/p/a713bae0a122
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-01-09 08:48:05
  • 阅读 ( 1890 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢