Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent git from using the global config?

Tags:

git

I have case where running some git related tests could generate failures if the user running them has some custom hooks installed inside his ~/.git-template/hooks folder.

Mainly I do want to find a way to run git commands in insolation, where git would skip using the default hooks and maybe even loading other global configs.

like image 673
sorin Avatar asked Oct 18 '22 09:10

sorin


1 Answers

To ignore the system config file (/etc/gitconfig), you can set the environment variable GIT_CONFIG_NOSYSTEM to 1/true/yes before running your command.

e.g. GIT_CONFIG_NOSYSTEM=true git <command>

https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables

like image 191
0x5453 Avatar answered Oct 21 '22 04:10

0x5453