git克隆错误:fatal: The remote end hung up unexpectedly

git clone公司的项目,遇到了三个问题

一、fatal: The remote end hung up unexpectedly

这个错误,原因可能是网速慢,文件大

可以尝试以下措施:

  1. 将Http缓存设置大一些,比如1G:git config --global http.postBuffer 1048576000,或者3G 3194304000
  2. 设置git最低速度
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999

设置之后,fatal: The remote end hung up unexpectedly这个错误没有了,又出现了新的错误

二、curl 18 transfer closed with outstanding read data remaining

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

有文章说可能是tag资源太大引起的
可以尝试先浅拷贝,再fetch

git clone --depth=1 http://git地址
git fetch --unshallow

执行git fetch --unshallow时又报了错误,再执行一次git fetch --unshallow就成功了,这个还不清楚怎么回事

项目下载下来了,但又有了新问题

三、只能看到master分支

现象是执行git fetchgit branch -a都只能看到master

参考这篇文章,打开配置文件,将

[remote "origin"]
url = https://github.com/xxx/project.git
fetch = +refs/heads/master:refs/remotes/origin/master

修改为

[remote "origin"]
url = https://github.com/xxx/project.git
fetch = +refs/heads/*:refs/remotes/origin/*

然后执行git fetch就可以拉下其他分支了

你可能感兴趣的:(git克隆错误:fatal: The remote end hung up unexpectedly)