【发布时间】:2014-03-08 14:38:58
【问题描述】:
我在 Windows 中使用 Git,并希望通过一次提交将可执行的 shell 脚本推送到 git repo 中。
通常我需要做两个步骤(git commit)。
$ vi install.sh
$ git add install.sh
$ git commit -am "add new file for installation" # first commit
[master f2e92da] add support for install.sh
1 files changed, 18 insertions(+), 3 deletions(-)
create mode 100644 install.sh
$ git update-index --chmod=+x install.sh
$ git commit -am "update file permission" # second commit
[master 317ba0c] update file permission
0 files changed
mode change 100644 => 100755 install.sh
如何将这两个步骤合并为一个步骤? git配置? windows命令?
提醒:两个答案都不错,新的git版本支持git add --chmod=+x file
参考:第二次提交请参阅Git file permissions on Windows 中的问题
【问题讨论】:
-
使用 git 2.9.x/2.10(2016 年第三季度),
git add --chmod=+x实际上是可能的。见my answer below,感谢Edward Thomson。 -
值得将所选答案更新为
git add --chmod=+x版本
标签: git