- To switch off automatic garbage collection from being triggered, we need to set the gc.auto configuration to 0. First, we'll check the existing setting, and then we can set it and verify the configuration using the following commands:
$ git config gc.auto # exit code is 1 when not set$ echo $?1 $ git config gc.auto 0 $ git config gc.auto 0
- Now we can try to run git gc with the --auto flag, as it will be called when normally triggered from an other command:
$ git gc --auto
- As expected, nothing happens, as the configuration disables automatic garbage collection. We can still trigger it manually though (without the --auto flag):
$ git gc Counting objects: 51, done. Delta compression using up to 8 threads. Compressing objects: ...