Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git creates huge temporary garbage objects

Tags:

git

I'd like to use git locally to track changes to a few local files, dispatched over my home directory.

I initialised a repository at ~, then added the few files with git add, and made a few commits. So far so good, .git is 300K large.

Problem is overnight, .git grew to 5.4G, filling my disk (maybe it could grow more). This happened twice : the first time, I re-created the repos, and the second time, git prune fixed it. Before pruning, git count-objects -v reported error: garbage found: .git/objects/95/tmp_obj_....

Edit : One hour after posting, it had happened again (and I pruned again).

Why does it happen, and how to fix it ?

(I tried to group all these files in a single directory with links but could come up with a working solution that would keep the files at their desired locations, but if the problem really comes with the repos being at ~/, then I would seek solutions in this direction.)

git version 1.7.10.4 on Debian GNU/Linux wheezy/sid

like image 665
Nikana Reklawyks Avatar asked Oct 09 '12 18:10

Nikana Reklawyks


1 Answers

Turns out I had another git repository auto-commiting with cron, the script of which had a broken cd in it (so it stayed in ~/, and run git add . >/dev/null, and commit, from there).

Many thanks to Alex Shepard for his help in chat, which led to this being pinned down.

like image 69
Nikana Reklawyks Avatar answered Oct 02 '22 14:10

Nikana Reklawyks