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失败的解决方法
 新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。
更多推荐


所有评论(0)