出处:https://www.shangmayuan.com/a/3d0c1215120148cfb4c7f9c2.html
码云上,因为仓库分支过多,提交历史超过了1G,直接clone会报错:git
fatal: early EOFweb
fatal: the remote end hung up unexpectedlycurl
fatal: index-pack failedsvg
error: RPC failed; curl 18 transfer closed with outstanding read data remainingfetch
git仓库分支过多,会形成git客户端在clone时失败,咱们应该逐步去clone。url
也就是依次经过分支名(branch name)去checkout。code
首先将项目的Head版本clone下来:xml
$ git clone --depth 1 仓库地址
depth 1的做用是只checkout第一个头部分支。这时候你能够看下checkout下来的Head版本指向了哪一个分支,查看当前已获取的分支:rem
$ git branch -a
最后经过分支名称去拉取分支信息以及checkout。依次执行以下指令:it
$ git remote set-branches origin '远程分支名称'
$ git fetch --depth 1 origin 远程分支名称
$ git checkout 远程分支名称