Look up any git config setting fast
Git’s behaviour is driven almost entirely by git config keys spread across many sections — core, user, diff, merge, pull, push, remote, alias and more. This reference lets you search those keys by name or description and filter by section, so you can find the right key and its expected value without leaving the page. Everything runs locally in your browser; nothing is uploaded.
How config files and scopes work
Git reads configuration from three files in order of increasing precedence:
| Scope | File location | Applies to |
|---|---|---|
| system | /etc/gitconfig (Linux/Mac) or C:\ProgramData\Git\config (Windows) | All users on the machine |
| global | ~/.gitconfig or ~/.config/git/config | Your user account |
| local | .git/config inside the repository | That repository only |
When the same key appears in more than one file, the most specific scope wins — local overrides global, which overrides system. Set a key with:
git config --global user.name "Your Name"
git config --local core.autocrlf input
git config --system init.defaultBranch main
Use --show-origin to see which file a value came from:
git config --show-origin push.default
And --list to dump the entire merged configuration:
git config --list --show-origin
Most commonly set keys
Identity (set once globally)
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
These appear in every commit you make. A missing user.email at a new job or on a new machine is the source of many “why does this commit show the wrong author?” questions.
Line endings
core.autocrlf is the most common source of cross-platform pain. The recommended values:
inputon macOS/Linux — converts CRLF to LF on commit but does not change checkouttrueon Windows — converts LF to CRLF on checkout and back to LF on commitfalse— no conversion (use only if your team is single-platform)
Pull behaviour
pull.rebase true makes git pull rebase your local commits on top of the fetched changes instead of creating a merge commit. This keeps history linear but rewrites your local commits. Set it to false if you prefer explicit merge commits.
Push behaviour
push.default simple (the modern default since Git 2.0) pushes the current branch to the same-name remote branch only if an upstream tracking link exists. This avoids accidentally pushing unrelated branches.
Useful quality-of-life settings
# Show conflict ancestors (makes resolving conflicts easier)
git config --global merge.conflictStyle zdiff3
# Use a better diff algorithm
git config --global diff.algorithm histogram
# Safer force-push (fails if remote has unexpected commits)
git config --global alias.pushf "push --force-with-lease"
# Short aliases
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.lg "log --oneline --graph --all"
Default branch name
git config --global init.defaultBranch main
Sets main as the branch name for new repositories, matching current GitHub/GitLab defaults.
Tips for the reference
- A value containing spaces must be quoted on the command line.
- A literal
#in a value must be quoted because it starts a comment in the config file. - To unset a key:
git config --global --unset push.default - To edit the global config file directly:
git config --global --edit