无法在git上克隆大型repo代码

时间:2018-01-11 05:41:05

标签: 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

4 个答案:

答案 0 :(得分:4)

看起来像curl error,这是一种典型的慢速互联网连接,很快关闭。

如此处所示,尝试shallow clone(或切换到ssh)

git clone https://ramweexcel@bitbucket.org/weexcel1/higher-education-haryana.g‌​it --depth 1

即便如此,作为I documented in 2011,您可能需要提升http.postBuffer

git config --global http.postBuffer 524288000

但这个想法仍然存在:从一个提交深度开始可以提供帮助。

从那里,你可以gradually increase the depth

git fetch --depth=<number-of-commits>

并且,经过几次迭代:

git fetch --unshallow

答案 1 :(得分:4)

git config --global http.postBuffer 524288000

git clone repo_url --depth 1

我已按照上述步骤操作,最后我成功克隆了我的代码。

答案 2 :(得分:2)

首先,尝试下载较小的数量,这样当网络出现故障时,您不必从零开始:
Taken From This Answeringyhere

  

首先,关闭压缩:

git config --global core.compression 0
     

接下来,让我们进行部分克隆以截断即将到来的信息量   向下:

git clone --depth 1 <repo_URI>
     

在这种情况下,请转到新目录并检索其余的   克隆:

git fetch --unshallow 
     

git fetch --depth=2147483647
     

现在,进行常规拉动:

git pull --all
     

我认为1.8.x版本中的msysgit出现故障   加剧了这些症状,因此另一种选择是尝试   git的早期版本(我认为<= 1.8.3)。

如果这没有帮助,因为您的网络仍然太不稳定或您的存储库仍然太大,请尝试使用其他网络-最好是有线网络。

对我来说,这不是一个选择。 VonC's Answer声明要执行git config --global http.postBuffer 524288000。如果您使用的是https,则可能需要改为git config --global https.postBuffer 524288000

最后,最后对我有用的是:
放弃并使用其他机器
如果它在您的笔记本电脑上可用,只需将该存储库拉到笔记本电脑上,然后运行

git bundle create /my/thumb/drive/myrepo.bundle --all  

并使用

将其还原到另一台计算机上
git clone /my/thumb/drive/myrepo.bundle

答案 3 :(得分:-1)

在尝试克隆存储库时,我也遇到了同样的错误:

remote: Enumerating objects: 231, done.
remote: Counting objects: 100% (231/231), done.
remote: Compressing objects: 100% (176/176), done.
error: RPC failed; curl 18 transfer closed with outstandifng read data remaining
atal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
  1. 确保您的互联网连接正常。

  2. 键入命令git clone https://github.com/tralpha/dash.git --depth 1

相关问题