Interrupted git fetches leave hidden temp files that can balloon repos to gigabytes
Killing a git fetch or clone mid-transfer leaves behind orphaned temporary pack files — named tmp_pack_XXXXXX — inside the .git/objects/pack/ directory, which Git never indexes, tracks, or cleans up automatically. These read-only files can accumulate silently over repeated failed fetches, swelling a repository to several gigabytes while causing symptoms like slow update checks and cryptic fetch errors. The root cause is Git's two-step pack-writing process: temp files are only renamed to their final names after a successful transfer, so an interrupted process leaves them stranded. Standard cleanup commands like git gc and git repack do not remove these files because Git's default prune grace period of two weeks skips anything created recently. Running git prune --expire=now or git gc --prune=now — after confirming no git processes are active and running git fsck --full to rule out deeper corruption — is the recommended fix.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in