Git Configuration: Difference between revisions
(→Files) |
|||
Line 19: | Line 19: | ||
* <code>[[.gitconfig#Overview|.gitconfig]]</code> | * <code>[[.gitconfig#Overview|.gitconfig]]</code> | ||
* <code>[[.config/git/config#Overview|.config/git/config]]</code> | * <code>[[.config/git/config#Overview|.config/git/config]]</code> | ||
* <code>[[.git/config]]</code> | * <code>[[.git/config#Overview|.git/config]]</code> | ||
* <code>[[.gitignore]]</code> | * <code>[[.gitignore]]</code> | ||
* <code>[[.gitattributes]]</code> | * <code>[[.gitattributes]]</code> |
Revision as of 22:17, 9 January 2024
Internal
Overview
Git maintains configuration in a hierarchy of files. System-wide configuration is maintained in /etc/gitconfig
. User-specific configuration is maintained in in ~/.gitconfig
or ~/.config/git/config
. Repository specific configuration is maintained 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.
The configuration files are plain-text, so values can be set manually by editing the file and inserting the correct syntax. It’s generally easier to run the git config command, though.