Git reads settings from several files: system, global, the repository itself and anything included from those. When a setting behaves oddly, the first question is where it’s set.
git config --show-origin --list
Every line now starts with the file it came from:
file:/home/alice/.gitconfig [email protected]
file:.git/config core.filemode=true
For one setting, ask for it by name. --show-origin works with a single key too, and --show-scope adds whether it’s system, global, local or worktree:
git config --show-origin --show-scope --get-all user.email
I’d use --get-all because a key can be set in more than one file. The last one wins, and seeing all of them explains why your global setting seems to be ignored: the repository’s own .git/config overrides it.
This is especially helpful with includeIf rules, where a work config gets pulled in only for certain folders. The origin shows the included file, so you can tell whether the rule matched at all.
Settings that come from environment variables, like GIT_AUTHOR_EMAIL, or from -c on the command line show up as command line: or not at all, because they’re not in a file. If the origin list looks right but git still does something else, check your environment with env | grep GIT_.
Further reading: git-config documentation
Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more