git clone failed报错 40445 bytes of body are still expected

git仓库过大致使clone失败的解决方法

仓库分支过多,提交历史超过了1G,直接clone会报错:

remote: Enumerating objects: 109541, done.
remote: Counting objects: 100% (109541/109541), done.
remote: Compressing objects: 100% (37502/37502), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 7031 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

尝试一:增大postBuffer

git config --global http.postBuffer 1524288000

结果无效

尝试二:压缩

compression 表示压缩,从 clone 的终端输出就知道,服务器会压缩目标文件,然后传输到客户端,客户端再解压。取值为 [-1, 9],-1 以 zlib 为默认压缩库,0 表示不进行压缩,1…9 是压缩速度与最终获得文件大小的不同程度的权衡,数字越大,压缩越慢,得到的文件会越小。

git config --global core.compression 0

结果无效

尝试三:浅层clone

//浅层clone代码 depth 1只会拉取最后一次log, depth(后面数字越大拉取的历史记录越多)
1.git clone --depth 1 远程地址
//拉取完整当前分支
2.git fetch --unshallow 

结果成功

经过分支名称去拉取分支信息以及checkout

git branch -a
git remote set-branches origin '远程分支名称'
git fetch --depth 1 origin 远程分支名称
git checkout 远程分支名称

文章转载自:git仓库过大致使clone失败的解决方法

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值