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
    

你可能感兴趣的:(Git出现"error: RPC failed; curl 18 transfer closed with outstanding read data remaining"的解决方法)