Search code examples
gitgithubignore-case

Github changing the folders case


When I'm cloning a branch from GitHub locally, the folder case is changing.

Let's say on GitHub it's tabsfolder, when I close locally, it becomes Tabsfolder.

I checked git configuration, core.ignorecase= true. This is a major issue because I can't manually change it locally.

Here's what I have installed locally.

MacOS bigSur
git version 2.27.0

Anyone faced this issue before?


Solution

  • Git is internally case sensitive. That's because most Unix machines are case sensitive and correctly case folding Unicode text in a locale-insensitive way is fundamentally impossible. However, by default, macOS uses a case-insensitive file system, although it can be configured to use a case-sensitive one.

    In order to handle this scenario, Git determines whether the system is on a case-sensitive file system when the repository is created, and if it is not, it sets core.ignorecase to true. This means that it enables certain workarounds for these systems to more gracefully handle this condition.

    Ultimately, your Mac doesn't care what the case of the folder is. All cases of your folder name are equally acceptable to it. If the case of the folder on disk matters to you, format your Mac's disk in a case-sensitive way so you can properly distinguish differences in case. The current limitation is a limitation or defect of your operating system, not of Git, which is operating correctly here.

    If, however, you need to tell Git to change a file or directory name in case to match a coding style or to make your project work properly on systems that are case sensitive, you can use git mv -f. A simple git mv is sufficient on a case-sensitive file system.