gitconfig
Gitconfig refers to the set of configuration files used by Git to control its behavior. Git reads configuration from multiple levels: system, global, and local (repository). The effective value of a setting is determined by precedence: local overrides global, which overrides system. This allows per-repository, per-user, and system-wide preferences.
- System: /etc/gitconfig on Unix-like systems; Windows systems use C:\ProgramData\Git\config.
- Global: ~/.gitconfig on Unix-like systems; on Windows, C:\Users\<user>\.gitconfig.
- Local: the .git/config file inside a Git repository.
Configuration files use an INI-like syntax with sections in square brackets and key = value pairs. Examples
- Include mechanism: the include directive allows pulling settings from additional files, and includeIf can conditionally load
- Viewing and editing: you can view settings with git config --list, and edit settings with git config
- Common purposes: set user identity (name and email), define command aliases, enable color output, configure the
Gitconfig centralizes configuration for Git at multiple scopes, enabling flexible customization of identity, interfaces, and command
---