Git configuration

Git provides configuration parameters that are specific to the repository, the user and the running system. The basic configuration sets information about the author / user, default editor and default exclude / ignored files. Further customization can be achieved via alias / abbreviations.

Setting Configurations

The git configuration can be changed with git config command with a location and the proper parameters.

# git config --location parameter

The location can be local (for the current repository), global (for the current user) and system (for the current system). The global configuration is stored in the home directory of the user and is saved in the file .gitconfig. Configuration for the current repository are stored in the .git project folder in the file config. System configurations are located in /etc/gitconfig under Linux.

System configuration:

# git config --system parameter

User configuration:

# git config --global parameter

Repository configuration:

# git config --local parameter

Git allows to query the configuration with the following command

# git config --list

Basic Configuration

Git stores with each commit the information about the author's name and the author's email address. Typically the author's name and the email address is set with the global location.

# git config --global user.name "User Name"
# git config --global user.email mail@domain.org

Alias / Abbreviation

Alias can abbreviate frequently-used commands. The basic syntax is:

# git config --global alias.ALIAS command

whereas ALIAS can be substituted with the actual abbreviation.

For example, the following command will abbreviate git checkout to the SVN-like git co:

# git config --global alias.co checkout

See Also

External Links