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 formWhat it does
--globalApply to every repository for your user account (stored in ~/.gitconfig)
--localApply to the current repository only. This is the default when you set a value
--list, -lShow every setting Git can see
--unset KEYRemove a setting
--show-originWith --list, show which file each setting comes from
-eOpen the config file in your editor

Examples

Set your identity once
git config --global user.name "Ana Lopez"
Set your email
git config --global user.email [email protected]
Start new repositories on main
git config --global init.defaultBranch main
Make a short alias
git config --global alias.st "status -sb"
See where a setting comes from
git config --show-origin user.email
file:/home/ana/.gitconfig	[email protected]

Notes

See also

Last reviewed 2026-10-09.