How Do I Make Git Ignore File Mode (Chmod) Changes?

Better Stack Team
Updated on June 24, 2024

To make Git ignore file mode (chmod) changes, you can use the core.fileMode configuration option. Here's how you can do it:

Option 1: Configure Globally

You can configure Git globally to ignore file mode changes for all repositories on your system:

 
git config --global core.fileMode false

This command sets the core.fileMode option to false globally, which means Git will ignore file mode changes for all repositories.

Option 2: Configure Per Repository

If you want to configure Git to ignore file mode changes for a specific repository, navigate to the repository's directory and run:

 
git config core.fileMode false

This command sets the core.fileMode option to false for the current repository only.

Note:

  • The core.fileMode configuration option controls whether Git considers changes to executable file permissions (file mode) as modifications that should be staged or committed.
  • By default, Git considers file mode changes when determining if files have been modified. Setting core.fileMode to false tells Git to ignore file mode changes, treating them as if they were not modifications.
  • Ignoring file mode changes can be useful if your development environment or workflow involves file mode changes that you don't want to track in Git.
  • After configuring core.fileMode to ignore file mode changes, Git will only consider changes to file content when determining if files have been modified.
Got an article suggestion? Let us know
Explore more
Git
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.