无法在Windows上提交update-index [英] Can't commit update-index on Windows
问题描述
我有一个名为 post_deploy
的可执行文件,它在推送后在我的OpenShift设备上运行,但它不可执行,所以我跑了:
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
但是每次我执行 git add
来提交文件时,该文件将失去可执行权限。如果我试图做一个 commit
,git会告诉我没有什么要提交的。我最终不得不弹出到Cygwin来使它工作,但是我怎样才能让它在Window的命令提示符下工作?
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?
推荐答案
检查你的Git版本:使用Git 2.9.1,你可以添加chmod
Check your Git version: with Git 2.9.1, you can add with chmod
git add --chmod=+x -- yourFile
同时检查 git config core.filemode
的值。我怀疑它应该是false(这是在不支持可执行位的环境中预期的)。
仍然, add --chmod = + x
应该足以记录Git仓库中的可执行位。
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.
最后,在Linux / Cygwin环境中克隆您的仓库,并检查该仓库是不是已经可以在那里执行了。
Finally, clone your repo in a Linux/Cygwin environment and check if the file is not already executable there.
OP NicholasJohn16 报告以下使用如何从Git中的暂时更改中删除说明旧模式100755新模式100644的文件?来解决问题。
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.
这篇关于无法在Windows上提交update-index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!