Re: Bug report: GIT_CONFIG and
Junio C Hamano
German Lashevich
Jeff King
See Also
Prev Ref 1 Ref 2
2021-07-14 21:36:09 UTC
On Wed, Jul 14, 2021 at 01:47:55PM -0700, Junio C Hamano wrote:

> 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.
>     -----------
>     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?

Yes, it looks like that description is from 2007 (when GIT_CONFIG really
did impact other commands). And adding GIT_CONFIG_GLOBAL and SYSTEM
nearby certainly didn't help (before then, I might have argued that
since GIT_CONFIG is only in git-config(1), it is more clear that it only
applies there).

Here's a short series to improve things.

  [1/3]: doc/git-config: explain --file instead of referring to GIT_CONFIG
  [2/3]: doc/git-config: clarify GIT_CONFIG environment variable
  [3/3]: doc/git-config: simplify "override" advice for FILES section

 Documentation/git-config.txt | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)