git rm –cached followed by git add -A changes file permissions

Question: Question:

A file,

git rm --cached text.php

After removing it from the stage as

git add -A


git diff 


old mode 100644
new mode 100755

Came out. Various

filemode = false

I understand that if you add to config, the permission change will be ignored and you can deal with it, but I don't understand the underlying reason and would like to know the following two points.

(1) Why delete from the stage-> Why does the permission change when you upload to the stage again? (2) Even though it is displayed that the permission has changed from 644 to 755, when you look at the file itself with ls -l , the permission is -rw-r--r-- It is -rw-r--r-- , not 755 ③ with git diff

 old mode 100644
 new mode 100755

I want to delete what has come out

Thank you for your cooperation.

Guest machine: run centOS 6.6 with vagrant.
Host machine: macOS
So, it is an environment where the contents of vagrant are being tampered with from macOS (without vagrant ssh) using phpstorm.

Answer: Answer:

I experienced the same phenomenon and solved it in the same way.
After all,
Files referenced / changed / created from Windows and
Because the permissions of the files referenced / changed / created from Linux are different
If you have committed a file created with a Windows editor, the repository will also have that permission,
If you have committed a file created on Linux (omitted)

Isn't that the case?
If you're playing with git with cygwin locally,
The file edited with windows becomes 644, and when committed with cygwin it becomes 755.
When cloned with cygwin and viewed on windows, it is different from the standard windows permissions, so> is added.
If you commit with windows and git commit -a with cygwin, the file mode will be changed.

I'm sorry I couldn't explain it well.

Scroll to Top