git config Read and set Git settings such as your name and email
Reads and writes Git settings. The first thing to set on a new machine is your name and email, which are stamped on every commit you make.
Synopsis
git config [--global | --local] KEY [VALUE]
git config --list [--show-origin]
Common options
| Option or form | What it does |
|---|---|
--global | Apply to every repository for your user account (stored in ~/.gitconfig) |
--local | Apply to the current repository only. This is the default when you set a value |
--list, -l | Show every setting Git can see |
--unset KEY | Remove a setting |
--show-origin | With --list, show which file each setting comes from |
-e | Open the config file in your editor |
Examples
git config --global user.name "Ana Lopez"
git config --global user.email [email protected]
git config --global init.defaultBranch main
git config --global alias.st "status -sb"
git config --show-origin user.email
file:/home/ana/.gitconfig [email protected]
Notes
- A local value overrides a global one, so you can use a work email in one repository and a personal one elsewhere.
- The email must match one on your GitHub account if you want commits linked to your profile.
- Run git config --list to check the current values before debugging odd behaviour.
See also
Last reviewed 2026-10-09.