How to find out which Git configuration file is used and how to override the settings?

I have two related questions:

  • How can I pinpoint which configuration file is used by my Git bash client?
  • Can I override the settings in the used configuration file?

I know that there is a system, global and local (aka project) .gitconfigfile. And, according to the Git site , each of these "levels" (system, global, local) overwrites the values ​​at the previous level, so the values ​​in the ./git/config(local) visor, for example, in /etc/gitconfig.

In other words, we are dealing with a hierarchy, and any declaration in the local configuration file will take precedence over one in the global or system configuration file.

But, if the parameter is present, for example, in a global file (for example, a proxy) and is not present in the local file, does this parameter use the proxy server parameter from the global? This would mean that Git works with all the settings in all configuration files before applying the hierarchy rule.

And then, in the example above, if the proxy server parameter from the global is used along with other settings in my local configuration file, how can I override it?

+6
source share
2 answers

How to determine which gitconfig file is used by my git bash client?

You can use the option --show-origin

git config --list --show-origin

This will show the file from which each setting value was executed.

Can I override the settings in the Git configuration file?

, , , .

, , . , , , , .

+5

, Git .

. . . , .

git :

.git/config , $HOME/.gitconfig .git/config . /etc/gitconfig .

,

, , - , ?

.

+2

Source: https://habr.com/ru/post/1015730/


All Articles