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

man page for "git config" re: GIT_CONFIG and "-f" seems weird/wrong

From
Robert P. J. Day <rpjday@crashcourse.ca>
Date
Oct 14, 2017, 09:55 UTC
Message-ID
<alpine.LFD.2.21.1710140538090.5453@localhost.localdomain>
  (apologies to those whose email systems barfed on my domain being
badly configured WRT MX record, i have been assured by my admin it's
been fixed.)
  reading "man git-config", first, it seems awkward that the "-f"
option is explained in terms of GIT_CONFIG even when that variable
hasn't been introduced yet:
  -f config-file, --file config-file
     Use the given config file instead of the one specified by GIT_CONFIG.

the way that's worded makes it seem like GIT_CONFIG *must* have a value somewhere that is being overridden. perhaps a more general explanation would be something like, "Explicitly use this, and *only* this config file, regardless of other possible config settings."

  it might also be worth mentioning that, once you specify this
option, also using any of --local, --global or --system will result in
an error:
  $ git config -l -f ~/gitc --global
  error: only one config file at a time.
  ... snip ...
  related to this, under "ENVIRONMENT", the explanation for GIT_CONFIG
seems somewhat draconian:
  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.

the word "forces" seems a bit heavy-handed, and the explanation is misleading, anyway ... if you've already set GIT_CONFIG, then using any other option of --local, --global or --system produces the same error as before:

  $ git config -l --system
  error: only one config file at a time.
  $

in other words, if GIT_CONFIG is already set, using --global or --system doesn't "force" anything, it's simply an error, no?

rday
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Message 1 of 1 in “man page for "git config" re: GIT_CONFIG and "-f" seems weird/wrong”
  1. Robert P. J. DayOct 14, 2017

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.