Git uses a series of configuration files to determine non-default behavior that you may want. The first place Git looks for these values is in the system-wide /etc/gitconfig
file, which contains settings that are applied to every user on the system and all of their repositories. If you pass the option --system
to git config, it reads and writes from this file specifically.
The next place Git looks is the ~/.gitconfig
or ~/.config/git/config
file, which is specific to each user. You can make Git read and write to this file by passing the --global
option.
Finally, Git looks for configuration values in the configuration file in the Git directory .git/config
of whatever repository you’re currently using. These values are specific to that single repository, and represent passing the --local
option to git config. (If you don’t specify which level you want to work with, this is the default.)
Each of these “levels” (system, global, local) overwrites values in the previous level, so values in .git/config
trump those in /etc/gitconfig
, for instance.
More here: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
Setting the basic Git configuration values:
git config --global user.email "GIT SERVICE EMAIL"
git config --global user.name "GIT SERVICE NAME (NOT USERNAME)"
git config --global color.ui always
git config --global color.branch always
git config --global color.diff always
git config --global color.interactive always
git config --global color.status always
git config --global color.grep always
git config --global color.pager true
git config --global color.decorate always
git config --global color.showbranch always