Thread (17 messages) flat view 17 messages, 6 authors, 12d ago

Re: [PATCH v2 0/3] config: read both home and xdg files for --global

From: Chris Torek <hidden>
Date: 2026-08-23 12:36:42

On Sun, Aug 23, 2026 at 3:31 AM Delilah Ashley Wu
[off-list ref] wrote:
Hi all, thanks for your patience. Here's my reroll.

As reported in [1], `$HOME/.gitconfig` and `$XDG_CONFIG_HOME/git/config`
are both valid global configuration locations. However, when both files
exist, `git config list --global` only reads from the former location
whereas `git config list` (without `--global`) reads from both. The same
issue was reported for `git config get` in [2]. This inconsistency has
no good justification and contradicts the documented behaviour.

Suppose that `$HOME/.gitconfig` contains:
    [home]
        config = true

and `$XDG_CONFIG_HOME/git/config` contains:
    [xdg]
        config = true

Then, listing with `--global` shows only the home config:
    $ git config list --global --show-scope --show-origin
    global  file:/Users/delilah/.gitconfig    home.config=true

and getting the XDG configuration entry with `--global` will fail:
    $ git config get --global xdg.config; echo $?
    1

Git still reads the XDG config as part of its effective configuration,
as shown by listing the configuration without `--global`:
    $ git config list --show-scope --show-origin
    global  file:/Users/delilah/.config/git/config    xdg.config=true
    global  file:/Users/delilah/.gitconfig            home.config=true

The documentation, quoted in [1] and [2], states that `--global` should
read from both files ...
I have a related question: which of the global file(s) does

    git config --global --edit

edit? Which one(s) should it edit?

Chris
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help