1

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?

NicholasJohn16
  • 2,390
  • 2
  • 21
  • 45

1 Answers1

2

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.


The OP NicholasJohn16 reports below using "How do I remove files saying “old mode 100755 new mode 100644” from unstaged changes in Git?" to solve the issue.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I'm using 1.9.5 so that might be the issue. Will update and try this if it happens again. – NicholasJohn16 Sep 09 '16 at 21:13
  • This unfortunately doesn't seem to work after upgrading to 2.10. – NicholasJohn16 Oct 06 '16 at 21:09
  • @NicholasJohn16 And (on Windows) the latest 2.10.1? (https://github.com/git-for-windows/git/releases/tag/v2.10.1.windows.1) released two days ago? – VonC Oct 06 '16 at 21:11
  • Was able to actually fix my issue with this question http://stackoverflow.com/questions/1257592/how-do-i-remove-files-saying-old-mode-100755-new-mode-100644-from-unstaged-cha so maybe it was a different issue I was having. – NicholasJohn16 Oct 06 '16 at 21:22
  • @NicholasJohn16 OK. I have included the link and your comment in the answer for more visibility. Was it the `git config core.filemode false`? – VonC Oct 06 '16 at 21:34