问题
最近clone公司工程总是遇到以下问题
git clone https://git.xxxxxxxxx
Cloning into 'XXXX-Android'...
remote: Enumerating objects: 5415, done.
remote: Counting objects: 100% (5415/5415), done.
remote: Compressing objects: 100% (614/614), 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
原因
根据网上信息来看,主要有以下几个问题:
- 缓存不够大
- 文件过多,包括提交记录过多
- 网络问题
解决
增大缓存
针对缓存问题,也是网上提及最多的,也就是配置以下内容:
git config --global http.postBuffer 524288000
一般介绍是设置为500M,我直接多加了个0,设置为5G,但还是存在报错
文件/提交记录过多
没有找到原理性原因,只是尝试约束了几个参数,就成功了
git clone -b master https://git.xxxxxxxxxxxx --depth 1
-b master
为只拉取主分支内容,可以将master
改为其他分支名称--depth 1
为只拉取最近一次提交的内容
btw:只设置了-b master
之后,错误信息减少了,所以进一步设置了depth,还需要深挖原因。
git clone -b master https://git.xxxxxxxxxxxxx
Cloning into 'xxxxxx-Android'...
remote: Enumerating objects: 5415, done.
remote: Counting objects: 100% (5415/5415), done.
remote: Compressing objects: 100% (614/614), done.
fatal: the remote end hung up unexpectedly23 MiB | 1.14 MiB/s
fatal: index-pack failed
网络问题
该上梯子上梯子,该进内网进内网,网络稳定了,成绩才好,不管是工作还是游戏。。。。
换协议
参考:刘大侠GG_B的error: RPC failed; curl 18 transfer closed with outstanding read data remaining的解决
clone 方式换成SSH的方式,即 https
改为 git
例如
git clone https://github.com/flutter/flutter.git
换成
git clone git://github.com/flutter/flutter.git