`git add` 操作时“不会添加文件别名 'samefile'('SameFile' 已存在于索引中)”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25580440/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:20:59  来源:igfitidea点击:

"Will not add file alias 'samefile' ('SameFile' already exists in index)" when `git add` operation

git

提问by naive231

I download linux' kernel source, and want to git addthem all.

我下载了 linux 的内核源代码,并且想要git add全部。

When I git add ., git starts add them. But soon it returns an error:

当 I 时git add .,git 开始添加它们。但很快它返回一个错误:

fatal: Will not add file alias 'include/linux/netfilter/xt_connmark.h' ('include/linux/netfilter/xt_CONNMARK.h' already exists in index)

That's weird, xt_connmark.hand xt_CONNMARK.hare TOTALLY DIFFERENT, why it complains that error? Those situations occur at other folders, too. I can't just change their names separately to solve this problem.

这是奇怪的,xt_connmark.h并且xt_CONNMARK.h完全不同的,它为什么抱怨错误?这些情况也发生在其他文件夹中。我不能仅仅改变他们的名字来解决这个问题。

Even I try git add --ignore-errors ., it doesn't works,too. It just stopped without ignoring this error. Anyone knows solutions?

即使我尝试git add --ignore-errors .,它也不起作用。它只是停止而没有忽略这个错误。有谁知道解决方案?

回答by Interlated

Edit .git/config to set ignorecase to false

编辑 .git/config 以将 ignorecase 设置为 false

[core]
  ignorecase = false

Can be set globally

可以全局设置

$ git config --global core.ignorecase false