当我试图从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

然后中止克隆。我该如何避免这种情况?


当前回答

我也面临着这个问题。解决它。 问题是网速很慢。请检查你的网络连接,别无其他。 我已经连接了良好的网速,然后它工作得很完美。希望对你有所帮助。

其他回答

对我来说,这个问题是因为代理配置。我在代理例外中添加了ip git服务器。 git服务器是本地的,但是no_proxy环境变量设置不正确。

我使用这个命令来识别问题:

#Linux:
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

#Windows
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1

作为回报,有“代理授权”,因为git服务器不应该通过代理。 但真正的问题是代理规则定义的文件大小

这些步骤对我来说是有效的:使用git://而不是https://

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

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

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

例如:

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

这对我很有用

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