`git fsck` reports `broken link from commit 1a2b3c4... to tree 4d5e6f7...` and `missing tree 4d5e6f7...`.
AdvancedTroubleshootingRepository Health, Size and Performance
Answer
Likely causes → Objects are genuinely missing: disk or filesystem corruption, a repo copied while Git was writing, an interrupted git gc on a network filesystem, or an objects/info/alternates file pointing at a repo that has since been deleted or pruned.
Diagnose →
git fsck --full
cat .git/objects/info/alternates 2>/dev/null
git cat-file -t 4d5e6f7
Fix → Missing objects can only be restored from another copy. If the remote has them, re-fetch into a fresh clone and move over local branches, or copy objects back:
git clone --mirror [email protected]:org/repo.git /tmp/good.git
git --git-dir=/tmp/good.git cat-file -p 4d5e6f7 >/dev/null && echo "remote has it"
cp -rn /tmp/good.git/objects/pack/* .git/objects/pack/
git fsck --full
If an alternate was removed, run git repack -a -d from a working copy before deleting the alternate next time.
Prevent → Never copy or sync a live .git with rsync/Dropbox, avoid alternates in shared setups, and keep backups (mirror clones).
More on Repository Health, Size and Performance
`git status` takes 8–15 seconds in a large monorepo.Intermediate`error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log` followed by `warning: There are too many unreachable loose objects; run 'git prune' to remove them.`IntermediateEvery few commands Git prints `Auto packing the repository in background for optimum performance.` and the machine stutters.BeginnerA fresh clone downloads 4 GB, but the checked-out files are only 200 MB.Intermediate`git gc` or `git clone` dies with `fatal: Out of memory, malloc failed (tried to allocate 1073741824 bytes)` or `error: pack-objects died of signal 9`.Advanced`error: unable to create temporary file: No space left on device` followed by `fatal: failed to write object`.Beginner