4

I have a repo that need to be run both in windows and linux, so need to set git config core.ignorecase false

but instead of asking each developer to set this in their repo, I want to add this in .gitattributes

I tried two things and both didn't work

[core]
    ignorecase = false

and

* text=auto ignorecase=false

I checked the .git/config file and content is like this:

enter image description here

if I set it to false, I can see that vscode is picking files names changes. but when I set that in .gitattributes vscode doesn't pick the changes.

how should I set it only for this repository so all developers don't need to set it manually?

Mohammad Hossein Amri
  • 1,842
  • 2
  • 23
  • 43
  • From git attributes document ( https://git-scm.com/docs/gitattributes ), I don't see anything about case sensitive or ignore case. I think that is not possible to do it in .gitattributes file. – vee Jun 29 '21 at 06:55

1 Answers1

2

No, do not do this. You cannot configure git to be case insensitive, despite what this setting's name suggests.

`core.ignorecase is not a configuration option; git detects whether your repository is on a case sensitive filesystem or not at initialization time. It saves this state in the configuration so that it doesn't have to needlessly requery over and over again, every time you run git.

Do not change core.ignoreCase. There is no way to change the fact that an ext3 filesystem is case sensitive and that HFS+ and NTFS are case insensitive by default. No setting to git can change this fact, and setting core.ignoreCase to the wrong value will break more things than you're trying to fix.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
  • 1
    you are wrong. please try first. if in windows you set git.ignorecase=false, and have a file name abc.text and rename it to ABC.text. you will get a rename commit, otherwise it will be ignored. – Mohammad Hossein Amri Feb 23 '21 at 01:32
  • 1
    That’s because you’ve told git you’re on a case insensitive filesystem, not because you’ve turned off some case sensitive mode option that means that your git operations will continue to make sense. I didn’t say you *couldn’t* change this. I said you *shouldn’t* change this. – Edward Thomson Feb 23 '21 at 08:39
  • this is the case that is happenning when you have a repo shared on both widnows and linux, I want to prevent this case happens https://stackoverflow.com/questions/26385447/git-says-not-under-version-control-for-just-checked-out-file/26385646#26385646 – Mohammad Hossein Amri Feb 23 '21 at 09:16