gitvariablesgit-gc

Setting variables on git remote repository - git gc doesn't run automatically


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?


Solution

  • 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...