背景

网络情况不稳定下克隆大文件项目(Android升级代码)时,特别是国外的仓库(如gitlab.com),会出现类似错误:

error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF

参考:https://blog.csdn.net/qq_34121797/article/details/79561110

解决:

查看当前git配置

git config -l

加大httpBuffer

git config --global http.postBuffer 524288000

修改压缩配置

git config --global core.compression -1

修改配置文件

打开调试命令

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1