Git Config
In one line
git config sets Git options at system, global (user), or repository level, controlling identity, aliases, and behavior.
In simple words
git config is the command that controls Git's configuration. Settings live at three levels: system (all users on the machine, in /etc/gitconfig), global (your user, in ~/.gitconfig), and local (the current repo, in .git/config). More specific levels override less specific ones.
The most common configs are user.name and user.email (who you are in commits), core.editor (what editor opens for commit messages), and init.defaultBranch (the default branch name for new repos). You can also set aliases, change the diff algorithm, and configure line-ending handling.
You read a value with git config user.name, set one with git config --global user.name "Ada", list all with git config --list, and unset with git config --unset. The --global flag writes to your user config so the setting applies to all your repos.
Example
# Set your identity globally (applies to all repos)
git config --global user.name "Ada Lovelace"
git config --global user.email "[email protected]"
# Set a repo-specific email (overrides global)
git config user.email "[email protected]"
# View a single value
git config user.name # Ada Lovelace
# List all settings and where they come from
git config --list --show-origin--global writes to ~/.gitconfig (all your repos). Without --global, it writes to the current repo. --list shows every setting.
Related terms
Related Resources
Related Lessons
- Git Setup
Learn git config.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.