Git How to Ignore File Mode (CHMOD) Changes (Examples)

In Git, you can ignore file mode changes (chmod) by setting the core.fileMode to false in the Git config:

git config core.fileMode false

This makes Git ignore the current folder’s file mode changes.

To ignore file mode changes in every Git project on your system, you need to run the above command with the –global flag:

git config --global core.fileMode false

Let’s see a concrete example that illustrates how file mode changes behave in Git and how ignoring those works.


Let’s see a concrete example of ignoring file mode changes in Git.

Here’s my sample project that’s under version control in Git:

In this folder, there’s a text file test.txt. It has the default (Linux) permissions at the moment.

$ ls -l test.txt
-rw-r--r-- 1

Now, let’s change the file mode of the test.txt such that it becomes executable (which doesn’t really make) by changing the file mode to 744:

$ chmod 744 test.txt

Now that the file mode has changed to 744, Git shows the change as well. This is because Git tracks changes to the executable permissions. (Had we touched some other permissions than the executable ones, Git wouldn’t see the change.)

Anyway, here’s what the git diff now looks like now:

Git only has three permission bits: 100644 for normal files, 100755 for executable files, and 120000 for symbolic links.

The old mode 100644 –> new mode 100755 in the git diff report means Git noticed that the file permissions went from non-executable to executable.

If you don’t want to track the file mode changes in your Git project, you need to set the core.fileMode to false using the git config command.

$ git config core.fileMode false

Now running git status or git diff doesn’t show changes anymore.

As a sanity check, let’s display the permissions of the file being tracked with the git ls-files –staged command:

And to compare, let’s check the actual file mode of the test.txt:

$ ls -l test.txt
-rwxr--r-- 1

This shows that the file mode of the test.txt is 744 locally, but in Git it’s still the default 644 which is exactly what we wanted to.

In other words, the file mode change only takes place locally and isn’t committed to the repository.


By default, Git tracks file mode changes that touch the executable permissions of your files. When you change a file from non-executable to executable (or vice versa), Git picks up on the change and you need to commit the changes.

To ignore file mode changes, you need to set the core.fileMode flag to false.

git config core.fileMode false

After this, you can freely change file modes locally but the changes won’t appear in Git.

Thanks for reading. Happy coding!

Read Also

What Is ‘origin’ in Git

Scroll to Top