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

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


当前回答

下面这些步骤对我很有用:

cd [dir]
git init
git clone [your Repository Url]

我希望这对你也有用。

其他回答

对我来说,问题是在整个克隆完成之前连接就关闭了。我用的是以太网而不是wifi连接。这对我来说就解决了

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克隆http://github.com/large-repository——depth 1在windows cmd上不起作用。尝试在windows powershell中运行该命令。

网络连接问题。 可能是由于持久连接超时。 最好的办法是换一个网络。

当我把一些代码推到Github时,我也遇到了同样的问题。

我尝试了git配置——global http。postBuffer 524288000,但它没有为我工作。

原因

这是因为你的提交历史和/或任何文件的大小更大。

我的情况

在我的例子中,是包锁。Json导致了这个问题。 它的大小为1500+KB,代码行数为33K。

我是怎么解决的?

我提交并推送了所有没有package-lock.json的东西 复制package-lock.json的内容。 创建一个名为package-lock的新文件。json从GitHub回购页面。 粘贴包锁的内容。Json并提交。 少管员停在本地。

和完成。

Tips

保持每个提交大小较小 推动经常 使用良好的网络连接

我希望这对你有所帮助。