git config
Get and set repository or global options
Git config allows you to view, add or edit git configuration. These configurations contain information about your user, repositories, aliases etc. Try and view them with git config -l
git config -l
credential.helper=osxkeychain
user.name=Githint User
alias.recent=branch --sort=-committerdate --format="%(committerdate:relative)%09%(refname:short)"
alias.st=status
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
core.editor=subl
Each line contains a configuration, starting with a name followed by the configured value (after '='). Individual config values can be read with git config config.name
and are stored on three different levels:
- - System level: applied to every user on the system and every repository. To list them run
git config --list --system
- - Global level: specific to your user only. To list them run
git config --list --global
- - Repository level: specific to a single repository. To list them run
git config --list --local
Changing the configurations
You can add a new configuration with git config config.key value
. By default a local configuration is created, which you can override with additional --global and --system options.
git config alias.st status
git config alias.st
status
Updating an existing configuration is similar to addition: git config config.key config.value.
git config alias.st
status
git config alias.st stash
git config alias.st
stash
You can also edit multiple configurations at once by editing the config file with git config --edit
. Use options --global or --system to edit the global or system level config files.
You can remove a configuration with git config --unset config.key
git config --unset alias.st
You can read more about the command in the official documentation.