Git set executable file permission on Windows
When interacting between Windows and Unix filesystems using Git,
setting a file to be executable takes a particular Git command from the Windows computer.
With standalone Unix systems, just chmod +x myfile.sh
is tracked by Git.
However, with Windows Subsystem for Linux or Cygwin,
this chmod +x
change is not tracked if the file resides on a Windows filesystem and
not within the WSL internal filesystem.
This confusing situation is overcome by this command:
git update-index --chmod=+x myfile.sh
Verify the change to executable permission by:
git status --porcelain=2
which will have output including:
1 M. N… 100644 100755 100755 … myfile.sh