【问题解决方案】git clone失败的分析和解决

参考链接

问题描述:

  • 无论是git clone还是pull,均失败,git clone大致是如下错误提示

remote: Counting objects: 5148, done.
remote: Compressing objects: 100% (16/16), done.
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

分析和解决:

  • 因为Git限制了推送数据的大小导致的错误。

解决:

  • 方法1:重新设置全局的通信缓存大小,增加git缓冲区大小

          git config --global http.postBuffer 524288000
          git config --list
    
  • 方法2:浅层克隆,深度设置为1

          git clone http://github.com/target.git --depth 1  # target.git 为目标地址
          cd target  #先进入库路径下
          git fetch --unshallow # 获取完整库
    
  • 注:

    • 如果用方法1设置后还不行,试试方法2,差不多就没问题了

END

原文地址:https://www.cnblogs.com/anliux/p/11668058.html