Re: [BUG] git config --global: doc and behaviour disagree when ~/.gitconfig and XDG config file coexist
Nils Fahldieck <[email protected]> Fri, 31 Jul 2026 20:19:06 +0200
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <CAAdFe9z7hE1Av=d4u6vUmvJjaDD0JXJpHb9UVd7oEiMpFV0PQg@mail.gmail.com> |
Hey there! > Agreed based on recent thread <[email protected]> (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 > > 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