Git出现"error: RPC failed; curl 18 transfer closed with outstanding read data remaining"的解决方法

当使用git clone或者git pull时,有时会出现如下的错误:

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命令增大缓存(单位是b,524288000B也就500M左右)
    #增大curl缓存
    git config --global http.postBuffer 524288000
    #查看设置是否生效
    git config --list
    
  2. 网络下载速度缓慢
    git config --global http.lowSpeedLimit 0
    git config --global http.lowSpeedTime 999999
    
  3. 代码库中文件太多,可以尝试浅层clone,再更新远程库到本地
    git clone --depth=1 https://github.com/xxxxx.git
    git fetch --unshallow
    
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。