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.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github