解决fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: fetch-pack。

在克隆仓库或者拉取代码的时候出现类似如下错误:
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

解决fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: fetch-pack_gitlab

git clone xxxxxxx

出现类似如下错误:

Cloning into ‘mobile’…
remote: Enumerating objects: 204, done.
remote: Counting objects: 100% (204/204), done.
remote: Compressing objects: 100% (195/195), done.
client_loop: send disconnect: Broken pipeB | 770.00 KiB/s
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output


解决方法:

主要是由于 仓库 内容比较大,或者仓库中有比较大的文件,由于 http 协议 或者 传输数据大小限制导致的,可以通过设置如下参数解决:

git config --global http.postBuffer 524288000
git config --global http.version HTTP/1.1

如果网络环境不太好,可以通过增加下面的参数,降低失败率:

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