Definitions
- case-sensitive filesystem: treats
john.jpg
and JOHN.jpg
as two different files and this is allowed.
- case-insensitive filesystem: treats
john.jpg
and JOHN.jpg
as one and the same file which is not allowed.
Problem
'components/User/index.js'
'components/user/index.js'
The problem here is that User
and user
are not allowed to co-exist at the same time inside the components
directory on a case-insensitive filesystem (which is NTFS if you're using Windows 10).
Solution for windows OS
If you have recently cloned the repo and have not done any work on it yet, I recommend that you start over. So remove the clone, then enable case-sensitivity for the directory you intend to clone your repo in, and then clone it anew. The benefit of doing this ahead of the cloning process is that all directories that are created as part of the cloning process by git will be case-sensitive and git will no longer give this warning. Plus, it enables you to clean up the mess.
- Open a command prompt as an administrator.
- Go to the directory where you intend to clone your repo. In this example I will use
C:UsersJuanDesktop
. You don't have to cd
to this directory to do the next step, just know what your target directory is.
- Enable case-sensitivity for the target directory. Command:
fsutil.exe file SetCaseSensitiveInfo "C:UsersJuanDesktop" enable
- Clone your repo. In this example I will use
https://github.com/torvalds/linux.git
. Command: git clone https://github.com/torvalds/linux.git
- (optional): Remove or rename conflicting files and folders if they are the same. You need to verify this by comparing them. To remove, use
git rm
and to move or copy, use git mv
.
- (optional): Commit and push up your changes to the upstream repo if you have write permission (and possibly after discussing the problem with the rest of the team).
- (optional): Disable case-sensitivity. Command:
fsutil.exe file SetCaseSensitiveInfo "C:UsersJuanDesktop" disable
Now you can go back to working on the project.
Source: Windows Central
Solution for macOS
On macOS, you will have to reformat volume as case-insensitive/sensitive or make a new volume altogether. Details
Reflection
You probably ran into this problem because you cloned a repo that was created on a computer that runs Linux or Mac, perhaps it was created by someone else and not you personally. The lesson here is to always be consistent with the way you name things, and this applies to everyone involved in a project. This is one example of what can happen otherwise.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…