Interview Prep/Git & GitHub/Repository Health, Size and Performance

`git count-objects -v` shows `garbage: 3` and `warning: garbage found: .git/objects/pack/tmp_pack_aB3dEf`.

IntermediateTroubleshootingRepository Health, Size and Performance
Answer

Likely causes → A fetch, push receive or repack was interrupted (network drop, Ctrl+C, OOM kill, full disk) and left a half-written temporary pack. These files can be very large.

Diagnose →

git count-objects -vH
ls -lh .git/objects/pack/tmp_* .git/objects/pack/*.pack
pgrep -a git        # make sure nothing is still writing

Fix → With no Git process running, delete the temp files and verify:

rm -f .git/objects/pack/tmp_pack_* .git/objects/pack/tmp_idx_*
git fsck --connectivity-only

git gc also removes stale temp files older than the prune expiry.

Prevent → Fix the root cause (disk, memory, flaky network) and let scheduled maintenance run.

All Git & GitHub questions Roadmap: Git & GitHub

More on Repository Health, Size and Performance