GIT 拉取错误 - 远程对象已损坏

发布于 2024-10-02 08:54:48 字数 505 浏览 4 评论 0原文

$ git pull

remote: fatal: object 21f3981dd35fccd28febabd96f27241eea856c50 is corrupted
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

有什么想法为什么会失败吗?
当我运行 git --bare fsck-objects --full 时,我只看到悬空链接,但没有损坏的链接。此外 git gc 也没有任何帮助。当我重新克隆或从另一个克隆中提取数据时,我没有看到此错误。

$ git pull

remote: fatal: object 21f3981dd35fccd28febabd96f27241eea856c50 is corrupted
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

Any ideas why this is failing?
When I run git --bare fsck-objects --full I just see dangling links but no broken links. Also git gc didn't help in any way. When I reclone or do pull from another clone, I don't see this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

太阳男子 2024-10-09 08:54:48

正如朱利安所说,请参阅 https://confluence.atlassian.com/ display/FISHKB/Git+indexing+fails+due+to+bad+pack+header

这确实可能是一个内存问题,为了确保我们不会丢失这里的解决方案,它是:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"

As Julian said see https://confluence.atlassian.com/display/FISHKB/Git+indexing+fails+due+to+bad+pack+header

It really can be a memory issue, and to make sure we don't lose the solution here it is:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"
海的爱人是光 2024-10-09 08:54:48

添加 git config --global pack.window "0" 对我有用...以及以下

git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m" 
git config --global pack.threads "1"

原因:

Git 克隆在克隆存储库时压缩数据

它压缩数据在接收数据/文件之前在服务器内存上。

如果服务器内存不足,您将在打包对象时出现上述错误。

您可以通过使用 git 克隆存储库来解决该问题,而无需使用以下命令打包服务器上的对象。

git config --global pack.window "0"

Adding git config --global pack.window "0" worked for me...along with following

git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m" 
git config --global pack.threads "1"

Reason:

Git clone compresses the data while cloning the repository

It compresses the data on the server memory before receiving the data/files.

If the server has out of memory you will get the above error while packing the objects

You can fix the issue by making git clone the repository without packing the objects on the server with the following.

git config --global pack.window "0"

半衾梦 2024-10-09 08:54:48

答案似乎在评论中:git fsck

It appears the answer is in the comments: git fsck

画骨成沙 2024-10-09 08:54:48

刚刚得到这个错误,花了半天时间做了帖子中描述的所有事情:fsck、repack、gc、配置内存选项。

还关注了这篇文章: http://git.kernel.org/cgit/git/git.git/tree/Documentation/howto/recover-corrupted-blob-object.txt?id=HEAD

但最后,就像在裸存储库中找到损坏的对象(在本例中为 21f3981dd35fccd28febabd96f27241eea856c50 )并将其替换为未损坏的版本(可以在从裸存储库拉取/克隆的任何本地存储库的 .git 文件夹中找到)一样简单存储库。)

Just got this error, and spent half a day doing all the things described in the post : fsck, repack, gc, configuring memory options.

Also followed this post : http://git.kernel.org/cgit/git/git.git/tree/Documentation/howto/recover-corrupted-blob-object.txt?id=HEAD

But in the end, it was as simple as finding the damaged object(21f3981dd35fccd28febabd96f27241eea856c50 in this case) in the bare repository and replacing it with the non damaged version(which can be found in the .git folder of any of the local repositories which pulled/cloned from the bare repository.)

鲸落 2024-10-09 08:54:48

在客户端中,尝试这样做:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"
git config --global pack.window "0"

或者在 git 服务器中,尝试这样做:
修改:/home/git/repositories/***.git/config,添加以下内容:

[pack]
         window = 0 

in the client,try do it like this:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"
git config --global pack.window "0"

or in the git server, try this:
modify: /home/git/repositories/***.git/config,add below:

[pack]
         window = 0 
挽你眉间 2024-10-09 08:54:48

对我来说,这是因为托管 git 存储库的远程服务器有损坏的对象/文件。当我尝试重新打包时,内存不足。我升级了实例内存,然后通过 ssh 重新登录并运行

git gc

以下是文档的链接:

https://git-scm.com/book/uz/v2/Git-Internals-Packfiles

For me this was because my remote server hosting the git repo had a damaged object/file. When I tried re-packing it was running out of memory. I upgraded my instance memory and then ssh-ed back in and ran

git gc

Here is the link to the documentation:

https://git-scm.com/book/uz/v2/Git-Internals-Packfiles

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文