tags:

views:

60

answers:

2

As we know, we can run `git gc' periodically to pack objects under .git/objects.

for a remote central git repository, for example, a git bare repository.

after many pushes, there many files under myproj.git/objects (seems one file for a commit?),

how to pack these many files, i mean on remote central bare repository, not on local clone repository.

+1  A: 

This question should shed some light on how often you should run garbage collection.

The easiest option would be to use a scheduled task in windows or a cron job in Unix to run git gc periodically. This way you don't even need to think about it.

Igor Zevaka
Thanks for your suggestions,but my question is how to run `git gc' on a remote bare repository, not on a local cloned repository.
peterwang
Pretty sure you can't invoke git gc remotely, that's why you have to schedule it on the machine containing the bare repository.
Igor Zevaka
+1  A: 

The remote repo should be configured to run gc as needed after a commit is made. See the documentation of gc.auto in git-gc and git-config man pages.

However, a remote repo shouldn't need all that much garbage collection, since it will rarely have dangling (unreachable) commits. These usually result from things like branch deletion and rebasing, which typically happen only in local repos.

So gc is needed more for repacking, which is for saving storage space rather than removing actual garbage. The gc.auto variable is sufficient for taking care of this.

Neil Mayhew