git说“致命的:被不稳定的对象源数据所迷惑” [英] git says "fatal: confused by unstable object source data"

查看:736
本文介绍了git说“致命的:被不稳定的对象源数据所迷惑”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了好玩,我试图将85GB的大部分大约6MB二进制文件放入git中。虽然Git在一段时间内一直处于困境,但总是在紧急:令人不安的对象源数据迷惑,然后是SHA1的消息的中途发生了一半的故障。你知道为什么吗?有什么方法可以解决这个问题吗?

解决方案




  • 一个或多个文件在操作过程中被修改,或者
  • 导致读取不一致(例如硬件故障)。

  • ul>

    简短版本:Git的开发人员不打算将其用于易失性文件。



    由于布局< Git使用松散对象和它假定的受限文件系统语义,Git必须知道对象名称的第一个字节(两个十六进制字符)(SHA -1),然后才能开始存储该对象。

    $ p $ objects / [0- 9a-f] [0-9a-f] / 目录。请参阅 gitrepository-layout


    **
    具体来说,它需要能够执行原子文件重命名。某些文件系统(通常是网络文件系统;我相信 AFS )只能保证源和重命名的目标位于相同的目录中。



    目前,Git在每个 new 文件上执行两次SHA-1传递。第一遍用于检查Git是否已知道文件的内容(其对象存储中是否已存在其SHA-1对象名称)。如果该对象已经存在,则不进行第二次传递。



    对于新内容(对象不在对象存储区中),将在第二次读取文件的同时压缩和计算被压缩数据的SHA-1。如果初始SHA-1(已存储?检查)与较晚的SHA-1(被压缩和写入的数据的散列)相匹配,则压缩的数据被写入临时文件,该临时文件仅被重命名为其最终松散对象名称。 。如果这些SHA-1哈希值不匹配,那么Git会显示您正在查看并中止的错误消息。此错误检查已添加到 748af44c63 中首先在Git 1.7.0.2中发布。


    Just for fun, I am trying to put around 85GB of mostly-around-6MB binary files into git. Git chugs along for a while but invariably fails about halfway through with the message "fatal: confused by unstable object source data" followed by a SHA1. Do you know why? Is there any way to fix it?

    解决方案

    Either

    • one or more files are being modified during your operation, or
    • something is causing inconsistent reads (e.g. failing hardware).

    Short version: Git’s developers did not intend for it to be used on volatile files.

    Due to the layout* that Git uses for "loose objects" and the limited filesystem semantics that it assumes**, Git must know the first byte (two hex characters) of the object name (SHA-1) of a new object before it can start storing that object.

    * The objects/[0-9a-f][0-9a-f]/ directories. See gitrepository-layout.
    ** Specifically, it needs to be able to do "atomic" file renames. Certain filesystems (usually network filesystems; specifically AFS, I believe) only guarantee rename atomicity when the source and the destination of a rename are inside the same directory.

    Currently, Git does two SHA-1 passes over each new file. The first pass is used to check whether whether Git already knows about the contents of the file (whether its SHA-1 object name already exists in the object store). If the object already exists, the second pass is not made.

    For new contents (object was not already in the object store), the file is read a second time while compressing and computing the SHA-1 of the data being compressed. The compressed data is written to a temporary file that is only renamed to its final loose object name if the initial SHA-1 ("already stored?" check) matches the later SHA-1 (hash of the data that was compressed and written). If these SHA-1 hashes do not match, then Git shows the error message you are seeing and aborts. This error checking was added in 748af44c63 which was first released in Git 1.7.0.2.

    这篇关于git说“致命的:被不稳定的对象源数据所迷惑”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆