4

I get the following message when I clone a project in my Mac:

Cloning into 'cinetogoproject'...
remote: Counting objects: 3863, done.
remote: Compressing objects: 100% (2777/2777), done.
remote: Total 3863 (delta 1203), reused 2940 (delta 762)
Receiving objects: 100% (3863/3863), 152.22 MiB | 3.12 MiB/s, done.
Resolving deltas: 100% (1203/1203), done.
Updating files: 100% (3109/3109), done.
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'frontend/dir1/source/src/dir2/Functions/index.js'
  'frontend/dir1/source/src/dir2/functions/index.js'

It might sound similar to this question, but my case is different because one of the colliding directories does not exist!

The problem arised because I renamed directory functions to Functions expecting git to manage the change normally, but the change is colliding with commits from other programmers when pulling.

Now, merge conflicts are reported and I am able to solve them... but git solves them for functions, that doesn't exist, and remain unsolvable for Functions, that does exist, even when the file contains no merging conflicts already.

Is there any wat to fix this?

HuLu ViCa
  • 5,077
  • 10
  • 43
  • 93

1 Answers1

1

This is indeed exactly the same problem. You have two directories differing only in case and you cannot write both to your system because your Mac is formatted in a case-insensitive way. They both exist to Git and are separate and independent, but your system is incapable of handling both at the same time.

The merge conflicts are probably being written into the tree for one file and then being overwritten by the other, which is why you cannot resolve them.

You have some options:

  • Reinstall your operating system (or format a new APFS partition) such that it is case sensitive and then check out the repository.
  • Use a Linux VM or a Linux Docker container and mount the repo to work with it.
  • Delete one of the directories, as explained in the Git FAQ.

If you and your collaborators plan to work on this project on systems that are case insensitive, I strongly suggest you adopt a policy mandating the case of names. Sometimes this is customary in your language or framework, such as how Java names its files cased exactly as the class is spelled, but if your framework lacks this, I suggest always using lowercase. You may want to enforce this in your CI system (e.g. by checking the output of git ls-files) for good measure.

bk2204
  • 64,793
  • 6
  • 84
  • 100