Configuration Files

Git’s configuration files are all simple text files in the style of .ini files. They record various choices and settings used by many Git commands. Some settings represent purely personal preferences (should a color.pager be used?); others are vital to a repository functioning correctly (core.repositoryformatversion), while still others tweak command behavior a bit (

Like many tools, Git supports a hierarchy of configuration files. In decreasing precedence, they are:


Repository-specific configuration settings manipulated with the --file option or by default. These settings have the highest precedence.


User-specific configuration settings manipulated with the --global option.


System-wide configuration settings manipulated with the --system option if you have proper Unix file write permissions on it. These settings have the lowest precedence. Depending on your actual installation, the system settings file might be somewhere else, like /usr/local/etc/gitconfig, or it might be entirely absent.

For example, to establish an author name and email address that will be used on all the commits that you make for all of your repositories, configure values for and in your $HOME/.gitconfig file using git config --global:

$ git config --global "Jon Loeliger"
$ git config --global ""

Or, to set a repository-specific name and email address that would override a --global setting, simply ...

Get Version Control with Git now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.