The git config command is for listing, querying and setting git configuration.
| Command | Abbreviated | Description |
|---|---|---|
git config --list |
-l |
list all git configuration that is set |
git config --list --show-origin |
-l --show-origin |
list all git configuration but also show where each item is set |
git config --list --show-scope |
-l --show-scope |
not as verbose as --show-origin but gives the scope to help with setting config |
git config --local --list |
--local -l |
list only the local config, where local means the current repository |
git config --global --list |
--global -l |
list the global config, or rather user config as the file ~/.gitconfig is used |
git config --system --list |
--system -l |
config is not often set here but it is for every user of the current computer and uses /etc/gitconfig to store this |
git config --global user.name "Geoff Lawrence" |
set the "user.name" to be "Geoff Lawrence", globally | |
git config --global user.email "geoff@example.com" |
as well as setting this globally you can also set it locally | |
git config --local user.email "stuff@example.com" |
set config for only the local repository, --local is optional |
|
git config --show-scope user.email |
display the currently applied value for user.email and where it came from, usually local or global |
There are more notes and help with this at Git Configuration which should be read in conjunction with this page as it also covers the use of the .gitattributes file.
See also: