Skip to content
Tutorials Center
My learning

Topics

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.

Terminal
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

Bash The probe and a case rename

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.

Bash Two names that differ only by case

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

Terminal
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 true on a case-sensitive disk, or false on a case-insensitive one, makes Git report files as missing or untracked.
  • Rename by case in two steps if git mv complains. On some setups you need git mv readme.md tmp && git mv tmp README.md, or git 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/ to docs/ 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.ignoreCase after moving a working tree to a different file system, or just clone again.
  • Mixed-case imports (import "./Utils" against a utils.js file) 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.symlinks and core.precomposeUnicode (macOS Unicode normalization).