Make Git ignore file mode (chmod) changes

Go to the root of the directory with the git clone ans type:\

git config core.fileMode false
// --global flag will make it be the default behavior for the logged in user
git config --global core.fileMode false
// Remove your local configuration to make the global configuration take effect
git config --unset core.fileMode

The git config command writes the setting to the correct config file (.git/config for just the current repository, or ~/.gitconfig if used with –global). Note that the global setting won’t be applied to existing repos! For each repo you need to run the local command (or it seems “git init” has the same effect). It seems that this setting is not inherited and should be reapplied if the repo is included as submodule. It will not work if the local config already had fileMode set to true. The local value will override the global setting.

Note that core.fileMode is not the best practice and should be used carefully. This setting only covers the executable bit of mode and never the read/write bits. In many cases you think you need this setting because you did something like chmod -R 777, making all your files executable. But in most projects most files don’t need and should not be executable for security reasons.