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

Re: [BUG] git config --global: doc and behaviour disagree when ~/.gitconfig and XDG config file coexist

From
Nils Fahldieck <nils@fahldieck.de>
Date
Jul 31, 2026, 18:19 UTC
Message-ID
<CAAdFe9z7hE1Av=d4u6vUmvJjaDD0JXJpHb9UVd7oEiMpFV0PQg@mail.gmail.com>
In-Reply-To
<336EEC18-98D3-4068-8C5C-476749959814@gmail.com>
Hey there!
> Agreed based on recent thread <20260720113402.0dc16abe@frustcomp.hnjs.home.arpa> (subject « git config: unintuitive behavior with - -global and - -no-includes » in case I have mis-transcribed the message ID, a necessity to maintain plain-text mail from my mobile phone, ahem).

Thank you very much for the other thread, I have read and understand the origin of `--global` way better now. This understanding reinforced a PR that I raised for the git-get helper binary. The origin of my problem is git-get's configuration, which reads its config via `git config --global key` instead of `git config --get key`. This is the PR for reference: https://github.com/grdl/git-get/pull/45

Show 7 quoted lines
> > So, "when the file does not exist or even if the file exists is not
> > readble, then it is not used and the other file is used instead"
> > would probably be technically more correct, but I am not sure if
> > such a change has much value (unless you are trying to be very
> > pedantic).
>
> My thoughts as well. A readable 0-byte file is not a counterexample to the docs; if such a file is readable then it exists, and is used as documented, no?

I agree and do not want to be pedantic about the implementation. I just tried to understand the code and added that to the report.

I still see a discrepancy between `git config --get` and `git config --global`, though. As a user it would make sense that if we have both `~/.gitconfig` and `~/.config/git/config` only one file is read and written in every case. Or in other words, with your explained expected behaviour, `git config --get` should not return a value. It is off-putting that some commands read both files where some do not. I am happy to understand the reasoning a little bit better, though. Maybe I have a missing connection in my head.

Anyway, I still feel that the documentation must be updated (at least) since Git is executing differently to it. I am happy to provide a patch for it. I just need to read up about how I contribute it for Git itself and the git-scm.com website including all i18n versions. Any hints are appreciated, my starting point would be https://git-scm.com/community though.

Best Nils

Previous: Ben KnobleNext: Delilah Ashley Wu
Message 4 of 7 in “[BUG] git config --global: doc and behaviour disagree when ~/.gitconfig and XDG config file coexist”
  1. Nils FahldieckJul 30, 2026
  2. Junio C HamanoJul 30, 2026
  3. Ben KnobleJul 31, 2026
  4. Nils FahldieckJul 31, 2026
  5. Delilah Ashley WuAug 13, 2026
  6. Nils FahldieckAug 21, 2026
  7. Delilah Ashley WuAug 22, 2026

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.