Git Configuration: Difference between revisions
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
=Overview= | =Overview= | ||
git maintains configuration in a hierarchy of files, from system-wide configuration in <code>/etc/gitconfig</code>, user-specific configuration in | git maintains configuration in a hierarchy of files, from system-wide configuration in <code>/etc/gitconfig</code>, user-specific configuration in <code>~/.gitconfig</code> or <code>~/.config/git/config</code>, to repository specific configuration in <code>.git/config</code>. | ||
<code>/etc/gitconfig</code> contains configuration that applies to all users of the system. <code>git config --system ...</code> reads and writes this file. User-specific configuration is read and written with <code>git config --global ...</code>. Repository specific configuration is read and written with <code>git config --local ...</code>. If no option is specified, --local is the default. | |||
Revision as of 19:56, 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.
It resolves a configuration element to the most specific value - a repository-level value takes precedence over a user-level values, and a user-level values takes precedence over the corresponding system-level value.