How git works when the file permission mode is changed

I changed the file mode by command chmod +111 file.txt then I checked GIT status and it showed:

On branch master Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)

 modified: file.txt

no changes added to commit (use "git add" and/or "git commit -a")

Then I committed the changes but after then it stopped taking file permission changes into account as even on changing permission level to +777 it shows

On branch master nothing to commit, working tree clean

Why file permission is not being taken into account anymore?

1

2 Answers

Git tracks exactly one bit of permission: executable or not executable.

You don't say what you mean precisely by "it stopped taking file permission changes into account", but my best guess is that you didn't change the executable permission, and so from Git's point of view, there was no change to take into account.

I suspect you've got git filemode set to false, and you want it true.

To show git filemode:

git config --get --local core.filemode

or

git config --get --global core.filemode

Values:

true: git tracks the executable bit for the file owner.

false: git does not track it.

Ref:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like