"git gc" says fatal: failed to write ref-pack file

git

Solution

The `.git` directory must be writable by your user and you must have enough free space on your storage device.

When Git creates a new pack, it first creates the new pack and after verifying its correctness it will delete the old pack as well as the newly packed loose objects. IOW you have to have at least the current size of your object database available as free space (simplified).

Problem

When I run `git gc` on a repository I have, it says ``` fatal: failed to write ref-pack file error: failed to run pack-refs ``` What does this error mean and how do I solve it?

Original source