git clone 下载代码一直报error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: the remote end hung up unexpectedly错误的解决思路

  1. 问题:git  clone  下载代码一直报错误

Cloning into 'aplanmis-project'...
remote: Enumerating objects: 176887, done.
remote: Counting objects: 100% (176887/176887), done.
remote: Compressing objects: 100% (75181/75181), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

 

  1. 解决思路
  • 把缓存区大小设置大点:根据项目的具体情况来设置缓冲区大小

git config --global http.postBuffer 524288000     # 2GB
git config --global http.postBuffer 2097152000        # 2GB
git config --global http.postBuffer 3194304000       # 3GB

  •  执行上面命令如果依旧clone失败,考虑可能原因2:网络下载速度缓慢
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999

2.用http方式下载代码,发现可能依旧会存在该问题,用ssh方式来下载代码,下面是ssh公钥配置的说明

  • 码云提供了基于SSH协议的Git服务,在使用SSH协议访问仓库仓库之前,需要先配置好账户/仓库的SSH公钥。可以参考:https://gitee.com/help/articles/4181#article-header0官网配置

生产ssh公钥:  ssh-keygen -t rsa -C "xxxxx@xxxxx.com"

邮箱地址: xxxxx@xxxxx.com
  • 按照提示完成三次回车,即可生成 ssh key。通过查看 ~/.ssh/id_rsa.pub 文件内容,获取到你的 public key

 

  •  登录码云官网,点击个人LOGO,选择“设置”、“安全设置”、“ssh公钥”,添加生成的 public key 添加到仓库中。

 

  • 测试是否可以连接成功
ssh -T git@gitee.com

 

 

  •  用ssh方式下载代码,发现可下载代码

git  clone   git@gitee.com:......ssh地址

 

 




posted @ 2019-11-01 18:34  千手修罗-锦  阅读(15991)  评论(0编辑  收藏  举报