Subject: Re: Bug report: GIT_CONFIG and user.email/name

From: Junio C Hamano <[email-masked]>
Date: Wed, 14 Jul 2021 13:47:55 -0700

Jeff King <[email-masked]> 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.

    ENVIRONMENT
    -----------

    GIT_CONFIG::
            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?

Thanks.

> One of these variables is probably more helpful:
>
>   $ man git | sed -n '/GLOBAL/,/^$/p'
>   GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM
>     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