Skip to content
Tutorials Center
My learning

Topics

Git Reference ยท Configuration Options

core.fileMode setting

Reference for core.fileMode: whether Git notices changes to the executable permission bit, why it is false on some file systems, and how to fix mode noise.

Git stores one permission detail for each file: whether it is executable. Blobs are recorded with mode 100644 (regular) or 100755 (executable), plus 120000 for symlinks. core.fileMode controls whether Git compares the executable bit on disk with the one in the index.

When it is true (the default on Linux and macOS), chmod +x shows up as a change. When it is false, Git assumes the file system cannot be trusted with permissions and ignores the bit in the working tree. git init and git clone probe the file system and set the value for you, which is why a repository on a Windows drive or a mounted FAT disk often contains filemode = false.

Terminal
git config core.fileMode false          # ignore executable-bit changes in this repository
git update-index --chmod=+x script.sh   # still record the bit explicitly

Try it

Bash Mode changes show up

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 Setting the bit without chmod

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.fileMode <bool>
Value Effect
true The executable bit of working tree files is compared with the index and reported as a mode change.
false The bit on disk is ignored. New files are added as 100644 unless you use git update-index --chmod.

Edge cases: only the owner-executable bit matters. Git never stores other permission bits, owners or timestamps. Directories are not recorded.

Usage notes

  • Symptom of a wrong setting: git diff lists every file with "old mode 100644 / new mode 100755" after a checkout from another system, or git status shows modified files with an empty content diff.
  • Fix for noise: set core.fileMode false for this repository. Do it per repository, since a global false hides real permission changes everywhere.
  • Fix a missing bit properly: git update-index --chmod=+x path records it in the index; commit it so everyone gets executable scripts.
  • WSL and Docker bind mounts often present everything as 755 or 777; this is the usual cause of the mode noise.
  • git diff -G and git apply can both be told to ignore modes, but the config is the reliable solution.
  • core.symlinks is the sibling setting for file systems without symlink support: when false, links are checked out as small text files.
  • git add --chmod=+x sets the bit while staging a new file.