git clone error:RPC failed; curl 18 transfer closed with outstanding read data remaining

git clone时报RPC failed; curl 18 transfer closed with outstanding read data remaining 错误

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,原因是因为curl的postBuffer的默认值太小,我们需要调整它的大小,在终端重新配置大小

解决方法:命令行输入

git config --global http.postBuffer 924288000

这里我们把postBuffer的值配置成900M。可以根据自己需要下载的文件大小,将postBuffer值配置成合适的大小。

可以根据以下命令查看postBuffer

git config --list

2,执行上面命令如果依旧clone失败,考虑可能原因2:网络下载速度缓慢

解决方法:命令行输入

git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999

3,如果依旧clone失败,则首先浅层clone,然后更新远程库到本地

git clone --depth=1 http://gitlab.xxx.cn/yyy/zzz.git
git fetch --unshallow

4,使用ssh进行拉取

生成本地ssh公钥:

ssh-keygen -t rsa -C "[email protected]"

一路回车即可;进入指定位置打开公钥文件,打开复制内容粘贴到gitlab的ssh配置页面。

gitlab添加ssh key

保存,完成,再次通过git bash窗口clone项目即可

git clone [email protected]:xxx/xxxxx.git

参考:https://www.cnblogs.com/zjfjava/p/10392150.html

猜你喜欢

转载自www.cnblogs.com/yizhilin/p/12940402.html