It seems that git refuse to do gc command automatically on my remote repository. In about one month that repository enlarge to about 6GB because of .pack files. I think that is problem with variable gc.auto - how can I set this variable on remote repsoitory, or how can I run git-gc command by hand on that repository?
2 Answers
You'll have to log in on the box where your remote repo is hosted and then simply type
git gc
on the command line.
Regarding gc.auto
: the docs say:
gc.auto
When there are approximately more than this many loose objects in the repository, git gc --auto will pack them. Some Porcelain commands use this command to perform a light-weight garbage collection from time to time. The default value is 6700. Setting this to 0 disables it.
However, you are talking about .pack
files. Seems like there's another option dealing with that:
gc.autopacklimit
When there are more than this many packs that are not marked with *.keep file in the repository, git gc --auto consolidates them into one larger pack. The default value is 50. Setting this to 0 disables it.
Note that gc.autopacklimit
works on the number of packs, not their sizes. Maybe you could tweak the gc
behavior using these...

- 64,417
- 29
- 168
- 201
Note: if your repo has only one pack file, a git gc
should not repack on git config gc.autoPackLimit 1
. Yet it did.
That is, it did until Git 2.10 (Q3 2016).
See commit 5f4e3bf (25 Jun 2016) by Eric Wong (ele828
).
(Merged by Junio C Hamano -- gitster
-- in commit 97865e8, 13 Jul 2016)
gc
: fix off-by-one error withgc.autoPackLimit
This matches the documentation and allows gc.autoPackLimit=1
to maintain a single pack without attempting a repack on every "git gc --auto
" invocation.
"
gc.autoPackLimit
" when set to 1 should not trigger a repacking when there is only one pack, but the code counted poorly and did so.

- 1,262,500
- 529
- 4,410
- 5,250