git clone 出现 “Connection to gitee.com closed by remote host”错误

在执行git clone 命令的时候,出现了这个错误
错误截图

$ git clone git@gitee.com:didispace/SpringBoot-Learning.git
Cloning into 'SpringBoot-Learning'...
The authenticity of host 'gitee.com (116.211.167.14)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com' (ECDSA) to the list of known hosts.
Connection to gitee.com closed by remote host.
fatal: Could not read from remote repository.

出现这个错误的原因是因为没有在git 或码云上面添加SSH key.
解决方法:
1、打开终端,输入

ssh-keygen -t rsa -C "xxxxx@xxxxx.com" 

然后三次回车,即可生成
注意,xxxxx@xxxxx.com是你在git上的用户名

2、查看你的 public key,并把他添加到码云(Gitee.com) SSH key添加地址:https://gitee.com/profile/sshkeys

cat ~/.ssh/id_rsa.pub

截图示例
然后在码云上面添加
截图示例
3、添加后,在终端(Terminal)中输入

ssh -T git@gitee.com

若返回
Welcome to Gitee.com, yourname!
则证明添加成功

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值