解决 git@github.com: Permission denied (publickey).fatal: Could not read from remote repository 问题

现象描述: 

       Windows 10中, 利用 git clone --recursive  https://github.com/ReFRACtor/ABSCO.git,   意图将包括submodule在内的库克隆到本地,执行时遇到如下的信息: 

Submodule 'LBLRTM' (git@github.com:AER-RC/LBLRTM.git) registered for path 'LBLRTM'
Submodule 'LNFL' (git@github.com:AER-RC/LNFL.git) registered for path 'LNFL'
Submodule 'common' (git@github.com:AER-RC/common.git) registered for path 'common'
Cloning into 'D:/MyProj/Simulation/ABSCO/LBLRTM'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:AER-RC/LBLRTM.git' into submodule path 'D:/MyProj/Simulation/ABSCO/LBLRTM' failed
Failed to clone 'LBLRTM'. Retry scheduled
Cloning into 'D:/MyProj/Simulation/ABSCO/LNFL'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

..........................................

解决办法:

     1) 执行ssh命令:  

            ssh-keygen -C "xxx@yyy.com"       

                其中xxx@yyy.com是github注册账号用的邮箱, 其它按照默认值连续回车处理  

           执行完成后,将会回显如下结果及秘钥存储位置(通常存储于 %USERPROFILE%下): 

                Your identification has been saved in C:\Users\USERNAME/.ssh/id_rsa.
                 Your public key has been saved in C:\Users\USERNAME/.ssh/id_rsa.pub.

                  (USERNAME是当前登录用户的用户名)

      2) 登录github账号设置SSH Keys

              访问网址

                     https://github.com/settings/keys​​​​​​​​​​​

                增加SSH Keys

            用Notepad等文本工具打开 C:\Users\USERNAME/.ssh/id_rsa.pub, 将公钥内容(如下图所示)贴入上图文本框中。 Title可以填写为自己认为可识别的相关标识。

 

           保存成功即可。 

  3) 重新执行git clone命令  

          重新执行git clone命令,所克隆的目录及其链接的submodule都会成功克隆到本地

  

解决了前一阶段困扰的一个小问题,特此mark.

参考致谢: 

         https://blog.csdn.net/dwjdj/article/details/117794541             

        https://blog.csdn.net/wcx1293296315/article/details/88693832

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值