git clone xxxxx 报错汇总及问题解决


问题1:fatal: Could not read from remote repository.

在服务器上运行 git clone xxxxx 下载程序时会报如下错误:

Warning: Permanently added ‘github.com,xx.xxx.xxx.xx’ (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

请添加图片描述

原因分析:

在GitHub中上传代码需要设置公钥,如果设置则可能是当前操作用户与GitHub中存储公钥不匹配。

解决方案:

  1. 首先查看自己是否有公钥。运行指令

cat ~/.ssh/id_rsa.pub

如果有公钥则会看到一大段字符串:ssh-rsa…,这就是所谓的publickey;但是如果提示报错的话则说明没有公钥,此时你应当自己创建一个公钥,输入

ssh-keygen

然后一直回车就行,最后会生成一个矩形框框一样的东西,就说明公钥已经生成。

请添加图片描述

此时再运行指令

cat ~/.ssh/id_rsa.pub

就会看到那一大段字符串,就是publickey。

  1. 复制公钥。从ssh-rea开始一直到末尾xxx@xxxxxx前,选中,右键copy复制。

请添加图片描述

  1. 登录GitHub,点击右上角头像 –> settings –> SSH and GPG keys –> new SSH key –> title自己取名,key中粘贴publickey –> Add SSH key –> 成功.

请添加图片描述

  1. 再次运行代码 git clone xxxxxxxxxxxx. 成功运行。

请添加图片描述

参考链接:


问题2:ERROR: Command errored out with exit status 128: git clone -q

在服务器上运行 git clone https://xxxxx 下载程序时会报如下错误:

fatal: unable to access 'https://github.com/cocodataset/cocoapi.git/': GnuTLS recv error (-9): A TLS packet with unexpected length was received. WARNING: Discarding git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI. Command errored out with exit status 128: git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-o_aocosg Check the logs for full command output. ERROR: Command errored out with exit status 128: git clone -q https://github.com/cocodataset/cocoapi.git /tmp/pip-req-build-o_aocosg Check the logs for full command output.

请添加图片描述

解决方案:

1. 可以尝试将命令行里的http改为git后重新执行。

请添加图片描述
2. 可以尝试执行以下代码:

git config --global http.postBuffer 2000000000

参考链接:


问题3:error: RPC failed; result=35, HTTP code = 0

error: RPC failed; result=35, HTTP code = 0
fatal: The remote end hung up unexpectedly

在这里插入图片描述

解决方案:

将 git clone https://github.com/***** 改为 git clone git://www.github.com/***** 。

在这里插入图片描述

参考链接:


问题4:gnutls_handshake() failed: The TLS connection was non-properly terminated

fatal: unable to access ‘https://github.com/aim-uofa/AdelaiDet.git/’: gnutls_handshake() failed: The TLS connection was non-properly terminated.

在这里插入图片描述

解决方法:

将 git clone https://github.com/***** 改为 git clone git://www.github.com/*****

在这里插入图片描述

  • 2
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值