当我试图从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 fetch --all  or git clone 

    

如果给出curl 56 Recv失败的错误,则通过zip或下载文件 指定分支的名称,而不是——all

git fetch origin BranchName 

这种情况经常发生,我的网络连接很慢,我不得不克隆一个相当大的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

简单的解决方案:与其通过https克隆,不如通过ssh克隆。

例如:

git clone https://github.com/vaibhavjain2/xxx.git - Avoid
git clone git@github.com:vaibhavjain2/xxx.git - Correct

正在更改git克隆协议尝试。

例如,当“git clone https://xxxxxxxxxxxxxxx”时发生此错误

你可以试试“git clone git://xxxxxxxxxxxxxx”,也许可以。

当我尝试从远程克隆时,反复出现同样的问题:

remote: Counting objects: 182, done.
remote: Compressing objects: 100% (149/149), 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 https://username@bitbucket.org/repositoryName.git --depth 1