git拉取和克隆错误致命:早期EOF;致命:解包对象失败。

8

很抱歉打扰您,我遇到了一个常见的问题。虽然在Stack Overflow上有很多解决方案,但这些解决方案都不适用于我。所以最后我别无选择,只能再次向您这个天才求助。

  1. 我在服务器上克隆了一个存储库。
  2. 当我在开发机器上更改了一些代码并将其推送到远程Git存储库时,一切都很顺利。
  3. 错误始于我从服务器拉取数据时。在服务器上,我输入命令git pull,出现以下错误:

remote: Counting objects: 66, done. remote: Compressing objects: 100% (65/65), done. Connection to bitbucket.org closed by remote host. fatal: The remote end hung up unexpectedly fatal: early EOF fatal: unpack-objects failed

  1. 我尝试了这个解决方案:fatal: early EOF fatal: index-pack failed,但是在第2步git clone --depth 1 <repo_URI>时出现错误。

错误信息如下:

Cloning into 'sinolife'... remote: Counting objects: 2783, done. remote: Compressing objects: 100% (2199/2199), done. Connection to bitbucket.org closed by remote host.00 KiB/s
fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed

  1. I also get a solution that there isn't enough swap memory. so i create a swap memory. At the beginning the swap is 0...After i config the swap, the free -m result is:

         total       used       free     shared    buffers     cached
    

内存:993 MB已使用,930 MB可用,已使用63 MB,空闲0 MB,缓存21 MB,已缓存57 MB。

除去缓冲区和高速缓存后:已使用851 MB,可用142 MB。

交换空间:499 MB已使用,16 MB可用,已使用483 MB。

但我也遇到了一些错误。

$git pull

remote: Counting objects: 66, done.
remote: Compressing objects: 100% (65/65), done.
Connection to bitbucket.org closed by remote host.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: unpack-objects failed

$git clone

Cloning into 'sinolife'...
remote: Counting objects: 2783, done.
remote: Compressing objects: 100% (2199/2199), done.
Connection to bitbucket.org closed by remote host.00 KiB/s     
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
  1. 还有git克隆时遇到"The remote end hung up unexpectedly"错误,按照步骤操作后仍然出现错误。以下是我的git配置文件

$git config -l

http.postbuffer=524288000
user.email= myemail@myemail.com
core.compression=0
core.compression=-1
core.compression=-1
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.compression=-1
core.packedgitlimit=512m
core.packedgitwindowsize=512m
remote.origin.url= my repository
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
pack.deltacachesize=2047m
pack.packsizelimit=2047m
pack.windowmemory=2047m
  1. 我的环境:

    uname -a

    Linux VM-87-192-ubuntu 3.13.0-86-generic #131-Ubuntu SMP Thu May 12 23:33:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

    git --version

    git 版本为 2.11.0

8. 希望有人能给我一些提示。

9. 问题概述

我有一个 git 仓库,并已在服务器上克隆,但当运行 git pull 命令时,出现错误:

remote: Counting objects: 66, done.
remote: Compressing objects: 100% (65/65), done.
Connection to bitbucket.org closed by remote host.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: unpack-objects failed

当开始一个新的克隆时 git clone

Cloning into 'sinolife'...
remote: Counting objects: 2057, done.
remote: Compressing objects: 100% (1740/1740), done.
Connection to bitbucket.org closed by remote host.00 KiB/s     
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

1
你的输出显示你正在使用bitbucket.org作为你的远程仓库;你是否联系过他们的支持团队?他们似乎经常遇到这种情况,因此可能有更多处理此错误的经验,并且肯定比我们更有能力解决与他们服务器的连接问题。 - Mark Adelsberger
@Mark Adelsberger 谢谢您的建议。我可以在我的开发机上克隆存储库,因此我得出结论,服务器没有连接问题。无论如何,我将联系 Bitbucket 寻求更多帮助,谢谢... - wuxianghou
5
@wuxianghou,你解决了你的问题吗?我也遇到了这个问题... - Yuga
我经常使用gitblit时会出现相同的问题(fatal: unpack-objects failed)。之前,通过将更改拉到全新分支以完成操作可以解决此问题。但是这一次我无法摆脱它(( - valijon
好的,我又解决了:跳转到您之前的提交。在那里创建临时分支。git pull origin your_branchgit checkout your_branch 然后再次拉取。我不知道为什么,但这解决了问题。 - valijon
@valijon,你能否发表一个答案?如果你解决了这个问题,你的解决方案不应该只是一个评论。 - Mike 'Pomax' Kamermans
3个回答

3
您可以通过选择以下任何一种方式来增加postBuffer大小来解决问题:
在终端中:
$ git config --global http.postBuffer 1048576000

或者修改gitconfig文件:

$ vim ~/.gitconfig # open gitconfig with ur favorite IDE

请在gitconfig文件末尾添加以下行:
[http]
        postBuffer = 1048576000

1
谢谢。这个解决了我的问题,尽管我不得不使用比你的答案中提到的更大的数字。 - fountainhead

0
有时候网络连接很重要。你需要确保你是否拥有适当的互联网连接。我也遇到了同样的问题,并通过更改我的互联网连接解决了它。

0

尝试将HTTP的postbuffer扩展到两倍?这对我有用。

git config --global http.postBuffer 1048576000

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接