Git不会忽略文件权限更改 [英] Git is not ignoring file permission changes

查看:557
本文介绍了Git不会忽略文件权限更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git不会忽略文件权限更改,即使 filemode = false 。在我的全局文件文件模式关闭,但每当我更改我的项目中的任何文件夹的权限,它正在追踪和显示差异。我不想跟踪我的权限更改。

在我的〜/ .gitconfig中设置

 [core] 
editor = vim
autocrlf = false
filemode = false

git version 2.7.4

解决方案

现有的存储库通常不受您的改变全球设置。



来自 git-config(1)
$ b


git config

创建一个新的仓库( git init )在新创建的本地 .git / config 文件中放置一个明确的 filemode 行;即使全局〜/ .gitconfig 文件没有这样的行(在这种情况下,硬编码的默认值 true 将会被使用)。事后改变全局配置不会改变这个;它只会影响后续的git-inits。



感谢 @jeremyclarke ,他对这个答案的宝贵意见
$ b


请在此答案中添加第二条警告,指出全局设置不适用于现有回购站!对于每个回购你需要运行本地命令(或者似乎git init具有相同的效果)。这会影响几乎每个人,并且可能会非常混乱(尤其是当您第一次与第二个仓库进行交互时,并且不知道为什么全局设置在第一个仓库中运行时无法正常运行),您同时运行全局和本地设置更改的版本。)



Git is not ignoring file permission changes even filemode = false. In my global file file-mode is off but whenever i changes permission for any folder in my project it is tracking and showing in diff. i don't want to track my permission changes at all.

settings in my ~/.gitconfig

[core]
    editor = vim
    autocrlf = false
    filemode = false

git version 2.7.4

解决方案

Existing repositories typically are not affected by your changing the global setting.

From git-config(1):

git config will only ever change one file at a time.

Creating a new repo (git init) puts an explicit filemode line in the newly created local .git/config file; even when the global ~/.gitconfig file has no such line (in which case the hard-coded default value true will be used). Changing the global configuration afterwards will not change that; it will only affect subsequent git-inits.

With thanks to @jeremyclarke for his valuable comment on this answer:

PLEASE add a second warning to this answer, stating that the global setting won't be applied to existing repos! For each repo you need to run the local command (or it seems "git init" has the same effect). This will affect pretty much everyone and can be extremely confusing (esp. when you first interact with a second repo and have no idea why the global setting isn't working when it worked on the first repo, where you ran both the global and local versions of the setting change.)

这篇关于Git不会忽略文件权限更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆