Git致命错误:打包文件在偏移量X处有损坏的对象:inflate返回了-5。

14

Git给了我一个可爱的圣诞礼物...我正在尝试git push一堆提交,大约6GB。但是我收到了以下错误消息:

-Counting objects: 525, done.
Delta compression using up to 24 threads.
Compressing objects: 100% (474/474), done.
fatal: pack has bad object at offset 3453162391: inflate returned -5
error: pack-objects died of signal 13
error: failed to push some refs to ....git

这是什么意思,该如何修复?从谷歌上我可以得知这与我尝试推送的大小有关。

在写作时发生了这种情况。


你尝试过使用 --no-thin 选项进行推送吗? - kaman
是的,不幸的是那并没有帮助到。 - Andrew Latham
你能否尝试只推送几个提交(例如HEAD~3),看看是否有帮助? - VonC
1个回答

8
根据您的偏移量,看起来您正在尝试推送一些非常大的对象(偏移量3453162391 =~ >= 3GB),因此zlib在解压缩/压缩对象时失败,因为输出缓冲区中没有足够的空间(错误:Z_BUF_ERROR)。
这可能与暂时缺乏内存或某些缓冲区限制有关。基本上,它正在尝试使用可用的输出尽可能多地处理输入,否则它将返回Z_BUF_ERROR。请参见:zlib inflate returning a buffer error
您应该重新尝试以查看是否可以重现问题。
如果问题是可重复的,则尝试:
  • avoid pushing large files into git repository, Git was designed to track the source code files, not very large files (like 6GB),

  • increase git message size on your client http.postBuffer, e.g.

    git config http.postBuffer 134217728 # =~ 128MB
    
  • use some alternative client which can ignore larger blobs, such as bfg, e.g.

    java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
    
  • remove the object which is causing the issue (git gc?).

其他可能存在的问题包括:

欲进一步阅读,请查看此帖子:“pack has bad object” when pushing to remote


如果您想使用Git处理大文件,请查阅以下内容:


1
只运行了一个 git gc 就解决了,谢谢你的答案! - WickedW

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