当我试图从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的内存需求。我已经将这些行添加到我的全局git配置文件。gitconfig中,该文件位于$USER_HOME中,即C:\Users\<USER_NAME>\.gitconfig

[core] 
packedGitLimit = 512m 
packedGitWindowSize = 512m 
[pack] 
deltaCacheSize = 2047m 
packSizeLimit = 2047m 
windowMemory = 2047m

其他回答

此问题出现在代理问题或网络缓慢时。你可以选择深度解决方案,或者

git fetch --all  or git clone 

    

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

git fetch origin BranchName 

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

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
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属性设置为较小的值并逐渐进一步增加

在更改为HTTP/1.1后,我在做git推送时遇到了这个错误。

解决方案:关闭我的VPN,重新运行git push。

这对我很有用

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1