修复损坏的git远程仓库

时间:2017-08-16 14:54:18

标签: git

尝试git pull,收到错误消息:

remote: error: inflate: data stream error (incorrect data check)
remote: error: corrupt loose object '188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7'
remote: fatal: loose object 188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7 (stored in 
./objects/18/8bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7) is corrupt
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

我发现this could be caused by out of memory on the server,但服务器的可用内存超过2GB。

我还发现this could be solved by doing a garbage collection on the remote repo,但这也会引发错误:

git gc
Counting objects: 61619, done.
Delta compression using up to 2 threads.
error: inflate: data stream error (incorrect data check)
error: corrupt loose object '188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7'
fatal: failed to read object 188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7: Invalid a
rgument
error: failed to run repack

所以我让一个文件系统检查在git repo上运行,并在我的远程存储库中执行git fsck,我收到以下错误消息:

error: inflate: data stream error (incorrect data check)
error: sha1 mismatch 188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7
error: 188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7: object corrupt or missing
error: inflate: data stream error (incorrect data check)
error: sha1 mismatch 9dabcbe39f25e3a79ee6f2bd1598999ea2c45de5
error: 9dabcbe39f25e3a79ee6f2bd1598999ea2c45de5: object corrupt or missing
Checking object directories: 100% (256/256), done.
error: index CRC mismatch for object b2e2916e7daeb3a4a9187774d9a19a29b5f3dce1 fr
om ./objects/pack/pack-d77b3f792b3870c0c121223a58776ef537871b41.pack at offset 3
8157638
error: inflate: data stream error (incorrect data check)
error: cannot unpack b2e2916e7daeb3a4a9187774d9a19a29b5f3dce1 from ./objects/pac
k/pack-d77b3f792b3870c0c121223a58776ef537871b41.pack at offset 38157638
Checking objects: 100% (156533/156533), done.
Checking connectivity: 61617, done.
dangling commit d6251eef8e78c1592174c10004fc20e031b34be1
missing blob 188bf75e9cfba7e0a93fa3a15bdcce6c1b8858c7
missing blob 9dabcbe39f25e3a79ee6f2bd1598999ea2c45de5

git试图告诉我什么,我该如何解决这个问题?如果有的话,我将来如何防止此类回购损坏?

1 个答案:

答案 0 :(得分:0)

几周前,我们终于找到了问题的根本原因。更换完所有磁盘并且错误仍然发生后,我们终于将所有内容从受影响的物理计算机上移开了。然后Memtest86告诉我们在哪里找到罪魁祸首。不知道如何在未检测到ECC内存的情况下发生这种情况,但是我不是管理员。