3

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?

1
  • The update wasn't enough? Commented Oct 6, 2016 at 21:04

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

5 Comments

I'm using 1.9.5 so that might be the issue. Will update and try this if it happens again.
This unfortunately doesn't seem to work after upgrading to 2.10.
@NicholasJohn16 And (on Windows) the latest 2.10.1? (github.com/git-for-windows/git/releases/tag/v2.10.1.windows.1) released two days ago?
Was able to actually fix my issue with this question stackoverflow.com/questions/1257592/… so maybe it was a different issue I was having.
@NicholasJohn16 OK. I have included the link and your comment in the answer for more visibility. Was it the git config core.filemode false?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.