Re: Bug report: GIT_CONFIG and
Jeff King
German Lashevich
Junio C Hamano
See Also
Prev Ref 1
2021-07-14 20:47:55 UTC
Jeff King <> writes:

> The GIT_CONFIG variable doesn't work that way. It is not a general
> mechanism used by all of Git, but rather a specific feature of the
> git-config program (and even there it is a historical wart; you should
> use "git config --file" instead).

We both have known that, but a fresh re-read of GIT_CONFIG in "git
help config" gave me a misleading impression.


            Take the configuration from the given file instead of .git/config.
            Using the "--global" option forces this to ~/.gitconfig. Using the
            "--system" option forces this to $(prefix)/etc/gitconfig.

is what we have above the GLOBAL and SYSTEM you quoted below.  We
should say GIT_CONFIG is only for "git config" command while the
other two affects everybody, right?


> One of these variables is probably more helpful:
>   $ man git | sed -n '/GLOBAL/,/^$/p'
>     Take the configuration from the given files instead from global or
>     system-level configuration files. If GIT_CONFIG_SYSTEM is set, the
>     system config file defined at build time (usually /etc/gitconfig)
>     will not be read. Likewise, if GIT_CONFIG_GLOBAL is set, neither
>     $HOME/.gitconfig nor $XDG_CONFIG_HOME/git/config will be read. Can
>     be set to /dev/null to skip reading configuration files of the
>     respective level.
> Note that they're new in v2.32.0.
> -Peff