這是關於一個Git回購的許多問題已損壞,正是一個鬆散的對象,出了問題之一:Git的損壞回購:如何從一個乾淨的倉庫挑一個git對象
$ git gc
Counting objects: 3299, done.
error: inflate: data stream error (unknown compression method)
error: unable to unpack 831a5d31af4a0af2f5a367689bee27a44efc22c9 header
Delta compression using up to 6 threads.
Compressing objects: 100% (3283/3283), done.
error: inflate: data stream error (unknown compression method)
fatal: loose object 831a5d31af4a0af2f5a367689bee27a44efc22c9 (stored in .git/objects/83/1a5d31af4a0af2f5a367689bee27a44efc22c9) is corrupt
error: failed to run repack
以下現有答案(How do I deal with corrupted git object files?,How to fix corrupted git repository?或What can I do with Git corruption due to a missing object?)我已經從損壞的存儲庫中刪除了對象831a5d31
。
在我的情況下,我有一個存儲庫的克隆,似乎持有我失蹤的對象,但沒有文件在objects/83/1a5d31af4a0af2f5a367689bee27a44efc22c9
。我該如何修復我的存儲庫?
這適用於blob對象;有沒有辦法導入/導出樹對象? – fuzzyTew 2016-11-09 16:21:35
回答我自己的問題,爲樹等對象做這個: 'git cat-file tree> temp' 'git hash-object -t tree -w temp' –
fuzzyTew
2016-11-09 16:31:41
謝謝,你救了我的回購!請注意,如果您的乾淨回購是來自不同的操作系統,則如果跨操作系統的行結尾不相同,則SHA1可能不匹配。但解決方案仍然有效。 – mrm 2017-09-18 00:24:23