git clone时报错:
fatal:the remote end hung up unexpectedly 0MiB
fatal:early EOF
fatal:index-pack failed
出现这种问题,一般是代码量太大或者网络异常
解决方案:
1.git clone时加上 --depth=1,比如:git clone xxx.git --depth 1
depth用于指定克隆深度,为1即表示只克隆最近一次commit.
这种方法克隆的项目只包含最近的一次commit的一个分支,体积很小。
这种方法克隆的项目只包含最近的一次commit的一个分支,体积很小,即可解决文章开头提到的项目过大导致Timeout的问题,但会产生另外一个问题,他只会把默认分支clone下来,其他远程分支并不在本地,所以这种情况下,需要用如下方法拉取其他分支:
$ git clone --depth 1 https://github.com/dogescript/xxxxxxx.git
$ git remote set-branches origin 'remote_branch_name'
$ git fetch --depth 1 origin remote_branch_name
$ git checkout remote_branch_name
这样就可以切到想要的分支了
2.如果上面的方法不奏效,那大概率是网络的问题;如果是网络问题,一是多试几次,不断的git clone ;二是,切换网络重试
网上其他的方法也有:
git config --global http.postBuffer 524288000 //设置http缓存大小500M
或 git config --global http.postBuffer 1048576000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
git config --global http.sslVerify false