ubuntu解决git clone时fatal Could not read from remote repository问题

问题现象:ubuntu下clone 代码库出现如下问题:

Cloning into 'OrbbecSDKStressTestTool'...

The authenticity of host '120.78.87.224 (120.78.87.224)' can't be established.

ECDSA key fingerprint is SHA256:uZepgq8XJ9zB/XIHCtZvyhlMRWuldWuWv2kuo3OobbQ.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '120.78.87.224' (ECDSA) to the list of known hosts.

gitlab@120.78.87.224's password:

Permission denied, please try again.

gitlab@120.78.87.224's password:

Connection to 120.78.87.224 closed by remote host.

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

 

问题原因:

在git 上没有创建SSH key。

 

解决办法:

第一步,生成key,需要输入的地方点击回车即可。

guanlin@ubuntu:~/.ssh$ ssh-keygen -t rsa -C "liguanlin@orbbec.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/home/guanlin/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/guanlin/.ssh/id_rsa.

Your public key has been saved in /home/guanlin/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:sr5HL4ndE1v15yTE4p4QdSW7OS+0LiP8gluLz3HaIWk liguanlin@orbbec.com

The key's randomart image is:

+---[RSA 2048]----+

|              ...|

|            . .o |

|           . o.  |

|          . . +o |

|      . S  o +=. |

|       o. o.o..++|

|      .+ *E*o.o+o|

|     .. *=OB=o ..|

|      ooo+==oo.  |

+----[SHA256]-----+

 

第二步,参看下SSH 是否已经生成。查看时,需进入~/.ssh目录,如果目录下有id_rsa 及 id_rsa.pub这两个文件说明SSH key已经生成了。

guanlin@ubuntu:~/.ssh$ ls

id_rsa  id_rsa.pub  known_hosts

 

第三步,添加私钥:

guanlin@ubuntu:~/.ssh$ ssh-add id_rsa

Identity added: id_rsa (id_rsa)

 

第四步,在gitlab 网页上添加公钥。即将id_rsa.pub文件中的内容拷贝出来添加到网页上。

guanlin@ubuntu:~/.ssh$ cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC77d3EVPLQB2/pjKBonSppmUr4WoJmpoSGbZrblMIoAfPaffDydWf7/ODbyieZASNBI4LT+mBwLbuxQYDx49VkeuMMPYnXR+0jO9OjnvCCCSWZTwi7EIRTGdfCRGDyyfrovqasIkyBEUURv1x7uE95le3S0OBW0h+ubDC3Dk+qBNXkhbD6ce1VzwPDTAuEzFjA86vIq1vix8os7IUsi6fjnmDUQeA3a7f3VwLtA6+z8s7Z1aY0c9lrGJh/Ib09G81/KpBjb9auvcb4oqWEj4PD2wWIEYj5OO/oE3rl5x36uA2gb8g3+ACUhWBGrFPPNI8+B2N/AGgK38zAhxVx9iLd liguanlin@orbbec.com

 

将上面内容拷贝出来后,粘贴到网页中Key的位置,点击Add key 即可添加成功。

 

这时重新clone就可以成功了。

 

参考博客:

https://www.cnblogs.com/wmr95/p/7852832.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值