简体   繁体   中英

How to prevent git from using the global config?

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.

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.

eg GIT_CONFIG_NOSYSTEM=true git <command>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM