テクノロジー · 実用ガイド
Git の pack 破損または index-pack 失敗?どの境界で byte が失われたかを先に証明する
pack の移動、再 clone、gc の前に local object database、transfer truncation、remote pack producer を分離します。

pack checksum mismatch と invalid index-pack output は同じ owner を示しません。後者は transfer truncation や remote producer failure の末端症状になり得ます。
pack 削除、唯一の worktree への再 clone、gc から始めません。first error と object database を保存し、境界を証明し、known-good source から復旧して objects、refs、work、repeatable transfer で閉じます。
first error を保存し object mutation を止める
command、Git version、repo path、stderr、exit、transport、credential を除いた remote、最初の checksum/CRC/bad offset/early EOF/index-pack 行を保存し、自動 gc、repack、prune、fetch、mirror、backup を止めます。
filesystem copy と uncommitted work/index changes を別に保存し、関係する .pack/.idx の name、size、hash を記録します。唯一の copy で試しません。
local、transfer、remote を判定する
stored pack checksum/CRC は local database を示しますが、clone の early EOF/index-pack は truncation、client disk、proxy/SSH、remote pack-objects の可能性があります。
healthy client、empty destination、approved alternate transport を比較します。一つの old clone、一つの repo の全 clone、一つの client の全 repo では意味が違います。
pack、index、objects、refs を対応付ける
copy 上で git fsck --full を保存し、exact idx/pack に git verify-pack を実行します。index-pack の成功だけでは required refs の reachability を証明しません。
pack checksum、index checksum/CRC、bad offset、missing referenced object、dangling object を分離し、依存 refs/commits を記録します。
known-good source から最小復旧する
disposable clone と完全な remote なら別 directory に clone し local changes と commit IDs を比較します。server damage なら verified backup または clone を使います。
exact object または verified pack だけを復旧します。salvage と unpack-objects は copy 上で行い、original evidence を削除せず incomplete repo に gc/prune しません。
integrity、refs、work、repeatability で閉じる
final full fsck、branches、tags、commit IDs、uncommitted work、critical objects を確認します。一つの checkout は全 object の証明ではありません。
new empty destination で original clone/fetch を再実行し、clean integrity、matching refs、accounted work、non-truncated transfer を確認します。
