解决 [email protected]: Permission denied (publickey).fatal: Could not read from remote repository 问题

现象描述: 

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

Submodule 'LBLRTM' ([email protected]:AER-RC/LBLRTM.git) registered for path 'LBLRTM'
Submodule 'LNFL' ([email protected]:AER-RC/LNFL.git) registered for path 'LNFL'
Submodule 'common' ([email protected]:AER-RC/common.git) registered for path 'common'
Cloning into 'D:/MyProj/Simulation/ABSCO/LBLRTM'...
[email protected]: 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 '[email protected]: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'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

解决办法:

     1) 执行ssh命令:  

            ssh-keygen -C "[email protected]"       

                其中[email protected]是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

猜你喜欢

转载自blog.csdn.net/cloudflash/article/details/126114719