相关疑难解决方法(0)

如何让Git忽略文件模式(chmod)的变化?

我有一个项目,我必须chmod在开发过程中将文件模式更改为777,但不应在主回购中更改.

Git选择chmod -R 777 .并将所有文件标记为已更改.有没有办法让Git忽略对文件进行的模式更改?

git ignore chmod

2188
推荐指数
10
解决办法
86万
查看次数

Git忽略gitconfig?

看来Git无视 ~/.gitconfig

$ git config --global core.filemode false

$ git config -l
core.filemode=false
core.filemode=true
Run Code Online (Sandbox Code Playgroud)

所以现在有2个条目core.filemode,git仍然没有忽略filemode的变化

$ touch modetest

$ git add .

$ git commit -m test1
[master (root-commit) 320cfe4] test1
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 modetest

$ chmod +x modetest

$ git diff
diff --git a/modetest b/modetest
old mode 100644
new mode 100755
Run Code Online (Sandbox Code Playgroud)

根据torek的回答,我将这一行添加到了我的.bash_profile

[ -d .git ] && git config core.filemode false
Run Code Online (Sandbox Code Playgroud)

git chmod git-config

9
推荐指数
2
解决办法
8039
查看次数

标签 统计

chmod ×2

git ×2

git-config ×1

ignore ×1