当我试图从GitLab (GitLab 6.6.2 4ef8369)克隆一个存储库时,我遇到了这个错误:
remote: Counting objects: 66352, done.
remote: Compressing objects: 100% (10417/10417), 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 clone --global core.compression 0
then
git clone --depth=1 <https://your_repo.git>
then
git fetch --depth=2
then
git fetch --depth=10
...
等等,直到他写到
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
最后你可以写
git fetch --unshallow
你会被扔出去
fatal: --unshallow on a complete repository does not make sense
如果在某个阶段再次得到错误,请尝试将——depth属性设置为较小的值并逐渐进一步增加
这种情况经常发生,我的网络连接很慢,我不得不克隆一个相当大的git存储库。最常见的问题是连接关闭,整个克隆被取消。
Cloning into 'large-repository'...
remote: Counting objects: 20248, done.
remote: Compressing objects: 100% (10204/10204), 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 clone http://github.com/large-repository --depth 1
$ cd large-repository
$ git fetch --unshallow