Auditing Your Configuration

Configuration accumulates from installers, tools and old blog posts, and some of it runs programs. Two questions are worth asking now and then: which keys are set in more than one place, and which settings execute something?

Finding duplicate keys and settings that run commandsShell
git config list --name-only | sort | uniq -d
git config get --all --show-scope --show-names --regexp 'alias\.|core\.(pager|hookspath)'
GIT_PAGER=cat git var GIT_PAGER
Output
filter.lfs.clean
filter.lfs.process
filter.lfs.required
filter.lfs.smudge
global  core.pager delta
global  alias.st status --short --branch
global  alias.lg log --graph --date=short --format='%h %ad %s%d'
global  alias.unstage restore --staged
global  alias.recent !git branch --sort=-committerdate | head -n 3
local   core.hookspath .husky/_
cat

The duplicates are the harmless LFS filter of Configuration Levels; chase duplicates with different values using --show-origin. --regexp matches key names, and the last line shows an environment variable outranking every file. Keys that run programs include core.pager, core.editor, core.hooksPath, core.sshCommand, credential.helper, filter.*, gpg.program and ! aliases; in a cloned repository's .git/config they would run on your machine, which is why Git 1,932 refuses to work in a repository owned by another user until you list it in safe.directory (Git 2.35.2). Keep your global file in a dotfiles repository, and delete what you no longer understand.