Home > Software engineering >  Cloned project from GitHub missing a folder
Cloned project from GitHub missing a folder

Time:12-27

enter image description here

I want to resolve this mess (I want only Scripts/), but when I cloned the project there seems to be only one Scripts folder.

Terminal

How could I sync them?

CodePudding user response:

Your issue is essentially that the file system on windows is not case sensitive, whilst GIT is. There are 2 folders with the same name but different capitalization in the repo.

You can either fix the error, for example by cloning the project on an OS that has a case sensitive file system, like linux and removing one of the folders.

I've done this in the past with Windows subsystem for linux (WSL) https://docs.microsoft.com/en-us/windows/wsl/

I'm using Azure devops so i've also renamed folders online to fix this kind of issue.

Another way is to enable case sensitivity for your specific folder on windows:

fsutil.exe file setCaseSensitiveInfo <path> enable

https://docs.microsoft.com/en-us/windows/wsl/case-sensitivity#modify-case-sensitivity

You'd wanna create a new folder, enable case sensitivity on that folder and then clone in your git repo in that folder. That way you should see 2 files. You can then correct your mistake by removing the file and changing the folder back to not be case sensitive, or you can leave it as-is.

I personally clone all my repose in subfolders under the path c:\repos so i've just set that folder to be case sensitive. It gets somewhat annoying sometimes with powershell commands (like for dotnet or nuget) now needing proper capitalization but it helps a lot when renaming folders in git repos.

EDIT: like @alexandr mentioned, you can also use git mv

git mv foo foo2
git mv foo2 FOO
git commit -m "changed case of dir"

https://stackoverflow.com/a/3011723/4122889

  • Related