`git gc` fails with `fatal: gc is already running on machine 'ci-runner-3' pid 4242 (use --force if not)`.
IntermediateTroubleshootingRepository Health, Size and Performance
Answer
Likely causes → A .git/gc.pid lock file exists. Either another gc really is running, or a previous gc was killed (container stopped, host rebooted) and left the file behind.
Diagnose →
cat .git/gc.pid
ps -p 4242 -o pid,cmd # only meaningful on the same host
Fix → If no gc process is running, remove the stale file or force it:
rm -f .git/gc.pid
git gc # or: git gc --force
Prevent → Avoid running gc in parallel jobs that share a workspace; disable auto-gc on runners (gc.auto=0) and run maintenance in one scheduled job.
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