Git Configuration: Difference between revisions
Line 14: | Line 14: | ||
<tt>/etc/gitconfig</tt> contains configuration that applies to all users of the system. <tt>git config --system ...</tt> reads and writes this file. User-specific configuration is read and written with <tt>git config --global ...</tt>. Repository specific configuration is read and written with <tt>git config --local ...</tt>. If no option is specified, --local is the default. | <tt>/etc/gitconfig</tt> contains configuration that applies to all users of the system. <tt>git config --system ...</tt> reads and writes this file. User-specific configuration is read and written with <tt>git config --global ...</tt>. Repository specific configuration is read and written with <tt>git config --local ...</tt>. If no option is specified, --local is the default. | ||
If specified in multiple location, a configuration element is resolved to the most specific value: a repository-level value takes precedence over a user-level values, and a user-level | If specified in multiple location, a configuration element is resolved to the most specific value: a repository-level value takes precedence over a user-level values, and a user-level value takes precedence over the corresponding system-level value. To use the effective value of a configuration element, use [[Git_config#Get_a_Setting|git config --get]]. | ||
=Environment Variables= | =Environment Variables= |
Revision as of 20:07, 18 July 2019
Internal
Files
Overview
git maintains configuration in a hierarchy of files, from system-wide configuration in /etc/gitconfig, user-specific configuration in ~/.gitconfig or ~/.config/git/config, to repository specific configuration in .git/config.
/etc/gitconfig contains configuration that applies to all users of the system. git config --system ... reads and writes this file. User-specific configuration is read and written with git config --global .... Repository specific configuration is read and written with git config --local .... If no option is specified, --local is the default.
If specified in multiple location, a configuration element is resolved to the most specific value: a repository-level value takes precedence over a user-level values, and a user-level value takes precedence over the corresponding system-level value. To use the effective value of a configuration element, use git config --get.