NicholasJohn16 NicholasJohn16 - 2 months ago 17
Git Question

Can't commit update-index on Windows

I have a executable file called

post_deploy
that's run on my OpenShift gear after a push, but it wasn't executable so I ran:

git update-index --chmod=+x .openshift/action_hooks/post_deploy


But every time I did a
git add
to commit the file, the file would loose the executable permission. If I tried to do a
commit
, git would tell me there was nothing to commit. I eventually had to pop over to Cygwin to get it to work, but how can I get this to work in Window's Command Prompt?

Answer

Check your Git version: with Git 2.9.1, you can add with chmod

git add --chmod=+x -- yourFile

Also check the value of git config core.filemode. I suspect it should be false (which is expected in an environment which does not support executable bit).
Still, the add --chmod=+x should be enough to record that executable bit in the Git repo.

Finally, clone your repo in a Linux/Cygwin environment and check if the file is not already executable there.