Git Reference ยท Configuration Options
core.ignoreCase setting
Reference for core.ignoreCase: how Git copes with case-insensitive file systems on Windows and macOS, why it is set automatically, and how to rename by case.
Linux file systems treat README.md and readme.md as two different files. Windows and (by default) macOS treat them as the same file. core.ignoreCase tells Git which world it lives in, so that it can match what it finds on disk with what it has in the index.
You almost never set it yourself. git init and git clone create a test file in .git, check whether a differently cased name finds it, and write ignorecase = true into the repository config if it does. On a case-sensitive file system the key is simply absent.
git config core.ignoreCase # prints true on Windows/macOS, nothing on Linux git mv readme.md README.md # rename by case: works on both kinds of file system
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
git config core.ignoreCase <bool>
| Value | Effect |
|---|---|
true |
Git compares paths case-insensitively when matching the working tree to the index. |
false or unset |
Paths are compared exactly. |
The index and tree objects are always case-sensitive: a tree can contain Notes.txt and notes.txt side by side regardless of this setting. The option only changes how Git interprets what it sees on disk.
Usage notes
- Leave the automatic value alone. Setting
trueon a case-sensitive disk, orfalseon a case-insensitive one, makes Git report files as missing or untracked. - Rename by case in two steps if
git mvcomplains. On some setups you needgit mv readme.md tmp && git mv tmp README.md, orgit mv -f. - Symptoms of a case collision: two tracked paths that differ by case are checked out into one file on Windows/macOS, so one of them looks permanently modified.
- Directory renames such as
Docs/todocs/are the usual trigger of "already exists in index" errors; do them with two moves. - A cloned repository can carry the wrong value if you copy the whole folder between machines; re-run
git config core.ignoreCaseafter moving a working tree to a different file system, or just clone again. - Mixed-case imports (
import "./Utils"against autils.jsfile) work on a developer laptop and fail on a Linux CI server. A case-sensitive CI run catches them. - Case-sensitive APFS volumes on macOS and per-directory case sensitivity on Windows exist, and Git's probe handles them, which is another reason not to hard-code the value.
- Related file-system probes:
core.fileMode,core.symlinksandcore.precomposeUnicode(macOS Unicode normalization).