git 致命:早期 EOF 致命:索引包失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21277806/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:37:17  来源:igfitidea点击:

fatal: early EOF fatal: index-pack failed

gitcygwinmsysgit

提问by William

I have googled and found many solutions but none work for me.

我用谷歌搜索并找到了很多解决方案,但没有一个对我有用。

I am trying to clone from one machine by connecting to the remote server which is in the LAN network.
Running this command from another machine cause error.
But running the SAME clone command using git://192.168.8.5 ... at the server it's okay and successful.

我试图通过连接到 LAN 网络中的远程服务器从一台机器进行克隆。
从另一台机器运行此命令会导致错误。
但是使用 git://192.168.8.5 运行相同的克隆命令......在服务器上它可以并且成功。

Any ideas ?

有任何想法吗 ?

user@USER ~
$ git clone  -v git://192.168.8.5/butterfly025.git
Cloning into 'butterfly025'...
remote: Counting objects: 4846, done.
remote: Compressing objects: 100% (3256/3256), done.
fatal: read error: Invalid argument, 255.05 MiB | 1.35 MiB/s
fatal: early EOF
fatal: index-pack failed

I have added this config in .gitconfigbut no help also.
Using the git version 1.8.5.2.msysgit.0

我已经添加了这个配置,.gitconfig但也没有帮助。
使用 git 版本 1.8.5.2.msysgit.0

[core]
    compression = -1

回答by ingyhere

First, turn off compression:

首先,关闭压缩:

git config --global core.compression 0

Next, let's do a partial clone to truncate the amount of info coming down:

接下来,让我们做一个部分克隆来截断下来的信息量:

git clone --depth 1 <repo_URI>

When that works, go into the new directory and retrieve the rest of the clone:

当它工作时,进入新目录并检索克隆的其余部分:

git fetch --unshallow 

or, alternately,

或者,或者,

git fetch --depth=2147483647

Now, do a regular pull:

现在,做一个常规拉:

git pull --all

I think there is a glitch with msysgit in the 1.8.x versions that exacerbates these symptoms, so another option is to try with an earlier version of git (<= 1.8.3, I think).

我认为 1.8.x 版本中 msysgit 的一个小故障会加剧这些症状,所以另一种选择是尝试使用早期版本的 git(我认为 <= 1.8.3)。

回答by bhdrkn

This error may occur for memory needs of git. You can add these lines to your global git configuration file, which is .gitconfigin $USER_HOME, in order to fix that problem.

git的内存需求可能会出现这个错误。您可以将这些行添加到您的全局 git 配置文件中,该文件位于.gitconfig$USER_HOME,以解决该问题。

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

回答by Hymany

finally solved by git config --global core.compression 9

终于解决了 git config --global core.compression 9

From a BitBucket issue thread:

来自 BitBucket 问题线程:

I tried almost five times, and it still happen.

Then I tried to use better compression and it worked!

git config --global core.compression 9

我尝试了将近五次,它仍然发生。

然后我尝试使用更好的压缩,它奏效了!

git config --global core.compression 9

From the Git Documentation:

来自 Git 文档:

core.compression
An integer -1..9, indicating a default compression level. -1 is the zlib default.
0 means no compression, and 1..9 are various speed/size tradeoffs, 9 being slowest.
If set, this provides a default to other compression variables, such as core.looseCompression and pack.compression.

core.compression
一个整数 -1..9,表示默认压缩级别。-1 是 zlib 默认值。
0 表示不压缩,1..9 是各种速度/大小的权衡,9 是最慢的。
如果设置,这将为其他压缩变量提供默认值,例如 core.looseCompression 和 pack.compression。

回答by cmpickle

As @ingyhere said:

正如@ingyhere 所说:

Shallow Clone

浅克隆

First, turn off compression:

首先,关闭压缩:

git config --global core.compression 0

Next, let's do a partial clone to truncate the amount of info coming down:

接下来,让我们做一个部分克隆来截断下来的信息量:

git clone --depth 1 <repo_URI>

When that works, go into the new directory and retrieve the rest of the clone:

当它工作时,进入新目录并检索克隆的其余部分:

git fetch --unshallow

or, alternately,

或者,或者,

git fetch --depth=2147483647

Now, do a pull:

现在,做一个拉:

git pull --all


Then to solve the problem of your local branch only tracking master

然后解决你本地分支只跟踪master的问题

open your git config file (.git/config) in the editor of your choice

.git/config在您选择的编辑器中打开您的 git 配置文件 ( )

where it says:

它说:

[remote "origin"]
    url=<git repo url>
    fetch = +refs/heads/master:refs/remotes/origin/master

change the line

换线

fetch = +refs/heads/master:refs/remotes/origin/master

to

fetch = +refs/heads/*:refs/remotes/origin/*

Do a git fetch and git will pull all your remote branches now

做一个 git fetch 并且 git 现在会拉你所有的远程分支

回答by sMajeed

In my case this was quite helpful:

就我而言,这很有帮助:

git clone --depth 1 --branch $BRANCH $URL

This will limit the checkout to mentioned branch only, hence will speed up the process.

这将把结账限制在提到的分支上,因此会加快这个过程。

Hope this will help.

希望这会有所帮助。

回答by elin3t

I tried all of that commands and none works for me, but what works was change the git_url to http instead ssh

我尝试了所有这些命令,但没有一个对我有用,但是有效的是将 git_url 更改为 http 而不是 ssh

if is clone command do :

如果是克隆命令,请执行以下操作:

git clone <your_http_or_https_repo_url> 

else if you are pulling on existing repo, do it with

否则,如果您正在使用现有的回购,请使用

git remote set-url origin <your_http_or_https_repo_url>

hope this help someone!

希望这有助于某人!

回答by André Laszlo

I got this error when git ran out of memory.

当 git 内存不足时,我收到此错误。

Freeing up some memory (in this case: letting a compile job finish) and trying again worked for me.

释放一些内存(在这种情况下:让编译工作完成)并再次尝试对我有用。

回答by iberbeu

In my case it was a connection problem. I was connected to an internal wifi network, in which I had limited access to ressources. That was letting git do the fetch but at a certain time it crashed. This means it can be a network-connection problem. Check if everything is running properly: Antivirus, Firewall, etc.

就我而言,这是一个连接问题。我连接到内部 wifi 网络,在该网络中我对资源的访问受到限制。那是让 git 进行获取,但在某个时间它崩溃了。这意味着它可能是网络连接问题。检查一切是否正常运行:防病毒、防火墙等。

The answer of elin3t is therefore important because ssh improves the performance of the downloading so that network problems can be avoided

因此,elin3t 的回答很重要,因为 ssh 提高了下载的性能,从而可以避免网络问题

回答by KimmyYang

Setting below's config doesn't work for me.

设置下面的配置对我不起作用。

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

As previous comment, it might the memory issue from git. Thus, I try to reduce working threads(from 32 to 8). So that it won't get much data from server at the same time. Then I also add "-f " to force to sync other projects.

正如之前的评论,这可能是 git 的内存问题。因此,我尝试减少工作线程(从 32 到 8)。这样它就不会同时从服务器获取太多数据。然后我还添加了“-f”来强制同步其他项目。

-f: Proceed with syncing other projects even if a project fails to sync.

Then it works fine now.

然后它现在工作正常。

repo sync -f -j8

回答by 8DH

A previous answer recommends setting to 512m. I'd say there are reasons to think that's counterproductive on a 64bit architecture. The documentation for core.packedGitLimitsays:

以前的答案建议设置为 512m。我想说有理由认为这在 64 位架构上适得其反。core.packedGitLimit文档说:

Default is 256 MiB on 32 bit platforms and 32 TiB (effectively unlimited) on 64 bit platforms. This should be reasonable for all users/operating systems, except on the largest projects. You probably do not need to adjust this value.

在 32 位平台上默认为 256 MiB,在 64 位平台上默认为 32 TiB(实际上无限制)。这对于所有用户/操作系统都应该是合理的,最大的项目除外。您可能不需要调整此值。

If you want to try it out check if you have it set and then remove the setting:

如果您想尝试一下,请检查您是否已设置,然后删除设置:

git config --show-origin core.packedGitLimit
git config --unset --global core.packedGitLimit