git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 14, 2021, 20:47 UTC
Message-ID
<xmqqeec0vczo.fsf@gitster.g>
In-Reply-To
<YO8ordiN18sNP6tA@coredump.intra.peff.net>
Jeff King <peff@peff.net> 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.
Show 15 quoted lines
> 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
Previous: German LashevichNext: Jeff King
Message 4 of 16 in “Bug report: GIT_CONFIG and user.email/name”
  1. German LashevichJul 14, 2021
  2. Jeff KingJul 14, 2021
  3. German LashevichJul 14, 2021
  4. Junio C HamanoJul 14, 2021
  5. Jeff KingJul 14, 2021
  6. 1/3 doc/git-config: explain --file instead of referring to GIT_CONFIGJeff King, Jul 14, 2021
  7. Taylor BlauJul 14, 2021
  8. Jeff KingJul 14, 2021
  9. Taylor BlauJul 14, 2021
  10. Martin ÅgrenJul 20, 2021
  11. Jeff KingJul 20, 2021
  12. Jeff KingJul 20, 2021
  13. Junio C HamanoJul 20, 2021
  14. 2/3 doc/git-config: clarify GIT_CONFIG environment variableJeff King, Jul 14, 2021
  15. 3/3 doc/git-config: simplify "override" advice for FILES sectionJeff King, Jul 14, 2021
  16. Taylor BlauJul 14, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.