What is a .gitconfig file?
text/plain
A .gitconfig file holds Git configuration in an INI-like syntax: bracketed section headers, optional subsection names in quotes, and `key = value` pairs. The same grammar serves the system, global, and per-repository files, which are layered in that order, and values may be booleans, integers with `k`/`m`/`g` suffixes, colours, or paths. Comments begin with `#` or `;`.
How to use a .gitconfig file
Use an example .gitconfig file to test INI-style configuration parsers and Git tooling, checking quoted subsection names, value continuation, boolean coercion, and precedence when the same key appears more than once.
Download example .gitconfig files
- Gitconfig - Sections, Quoted Subsections and Shell AliasesA realistic global config exercising the whole INI-like grammar: bracketed sections, quoted subsection names that are case-sensitive while section names are not, values with size suffixes, a shell alias whose leading `!` changes how the rest is executed, and both comment characters.
- Gitconfig - includeIf Conditions in Four FlavoursEvery conditional-include form git supports — path prefix, case-insensitive path prefix, branch glob, and a condition on an existing remote URL — plus one unconditional include. Order matters: a later include overrides an earlier one, so a parser that gathers includes into a set rather than a list resolves the wrong identity.