Skip to content

Ignore file permission change in git

From git-config(1):

The -c flag can be used to set this option for one-off commands:

And the --global flag will make it be the default behavior for the logged in user.

Warning

core.fileMode is not the best practice and should be used carefully. This setting only cover the executable bit of mode and never the read/write bits. In many cases you think you need this settings 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.

The proper way to solve this kind of situation is to handle folder and file permission separately, with something like:

If you do that, you’ll never need to use core.fileMode, except in very rare environment.

NOTE:

If above does not work for you, your local repo might have a config that already has

and the global config will never work as the local config is much more priority. To do that, cd into your local project folder like so:

and change the filemode directive to false:

That’s it!

REF: https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes

Published indeploymentservers

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *