How do I make Git ignore file mode (chmod) changes? -
I have a project in which I have to change the mode of the file from Git chmod <745 to 777 , But it should not be changed to the main repo
raises on chmod-R 777.
and changes all the files as has been changed. Is there any way to ignore the changes to the file in the file?
Try:
git config core.filemode false
to:
core.fileMode If incorrect, the executable bit is ignored between the difference index and the copy of the work; Use Git-update-index (1) useful on broken filesystem like fata is correct by default
To set this option for one-off commands, -c
flag can be used:
git -c core.fileMode = false diff
and - Global
flag This will be the default behavior for the login user.
git config --global core.fileMode false
warning
core.fileMode
best practice And should be used carefully. This setting only covers the executable bit mode and never read / write bits. In many cases you feel that you need this setting because you have done something like chmod-R 777
, which makes all of your files executable but most of the projects include Most files It is not required for security reasons and it should not be executable .
The correct way to resolve this type of situation is to handle folders and file permissions separately, like with something:
Find-type d -exec chmod a + rwx {} \; # Folders create traceable and read / write search-type f -exec chmod a + rw {} \; # Read / Write Files
If you do this, you will never need to leave in rare environment and use core.fileMode
.
Comments
Post a Comment