如何阻止 git 在 cygwin 上使文件不可执行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7048763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to stop git from making files non-executable on cygwin?
提问by maaartinus
I use git on Windows via cygwin and soon decided to use filemode=false
(since otherwise I've got a lot of changes after the initial git clone). I'm definitely not interested in tracking permission at all, the only think I need is for some files to be executable. From time to time, I find that the x
flag on some files gets lost and I strongly suppose it's because of git.
我通过 cygwin 在 Windows 上使用 git 并很快决定使用filemode=false
(因为在最初的 git 克隆之后我有很多更改)。我绝对对跟踪权限根本不感兴趣,我唯一需要的是某些文件是可执行的。有时,我发现x
某些文件上的标志丢失了,我强烈认为这是因为 git。
I'd be happy with a solution allowing to execute chmod a+x ...
when needed.
我对允许chmod a+x ...
在需要时执行的解决方案感到满意。
回答by Karl Bielefeldt
I believe you want git update-index --chmod=+x <file>
, followed by a commit.
我相信你想要git update-index --chmod=+x <file>
,然后是提交。
回答by Alexander Pogrebnyak
You should start with git update-index --chmod=+x <file>
.
你应该从git update-index --chmod=+x <file>
.
But this does not change your working copy, for that:
但这不会改变您的工作副本,为此:
git checkout .
回答by think2010
I've met the same problem. git update-index --chomd=+x doesn't work for me.
我遇到了同样的问题。git update-index --chomd=+x 对我不起作用。
I use chmod +x , then commit, it works perfect.
我使用 chmod +x ,然后提交,它完美无缺。