GIT 拉取错误 - 远程对象已损坏
$ 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
正如朱利安所说,请参阅 https://confluence.atlassian.com/ display/FISHKB/Git+indexing+fails+due+to+bad+pack+header
这确实可能是一个内存问题,为了确保我们不会丢失这里的解决方案,它是:
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.window "0" 对我有用...以及以下
原因:
Git 克隆在克隆存储库时压缩数据
它压缩数据在接收数据/文件之前在服务器内存上。
如果服务器内存不足,您将在打包对象时出现上述错误。
您可以通过使用 git 克隆存储库来解决该问题,而无需使用以下命令打包服务器上的对象。
git config --global pack.window "0"
Adding
git config --global pack.window "0"
worked for me...along with followingReason:
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"
答案似乎在评论中:
git fsck
It appears the answer is in the comments:
git fsck
刚刚得到这个错误,花了半天时间做了帖子中描述的所有事情: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.)
在客户端中,尝试这样做:
或者在 git 服务器中,尝试这样做:
修改:
/home/git/repositories/***.git/config
,添加以下内容:in the client,try do it like this:
or in the git server, try this:
modify:
/home/git/repositories/***.git/config
,add below:这为我解决了问题,希望对其他人有帮助。 :)
https://confluence.atlassian.com /display/FISHKB/Git+indexing+fails+ due+to+bad+pack+header
This fix the problem for me and hope helps sombody else. :)
https://confluence.atlassian.com/display/FISHKB/Git+indexing+fails+due+to+bad+pack+header
对我来说,这是因为托管 git 存储库的远程服务器有损坏的对象/文件。当我尝试重新打包时,内存不足。我升级了实例内存,然后通过 ssh 重新登录并运行
以下是文档的链接:
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
Here is the link to the documentation:
https://git-scm.com/book/uz/v2/Git-Internals-Packfiles