I cannot delete the "cloned" folder with Case-Sensitive in my Github repository

Asked

Viewed 37 times

1

I created a repository on Github and sent my application containing an X folder with the full name in lower case, when actually the first letter of the name should be uppercase.

To solve this problem, I executed the following command:

git config core.ignorecase false

I managed to change the name of the folder and gave push to the repository. The problem is that in Github, the folder with the lowercase name is still there, along with the uppercase folder. Example:

folder/
Folder/
file.txt

When I give one pull or clone to remove the lower case folder, Git generates the following warning:

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:

And when I open the directory of my application, with the files and folders pulled from Github, here on the computer, only appears the folder with the name in upper case, preventing me to delete the folder with the lower name.

Folder/
file.txt

What do I do to delete the folder with the old name?

  • The problem is because by default Git is not case sensitive. Once the sensitivity is activated (as you yourself put it at the beginning of the question), the problem would not occur in the first place. Of course, this doesn’t solve the problem that has already occurred, but if Git were always box-sensitive it wouldn’t happen, so it serves as "prevention" for similar future problems. That’s why I posted the comment.

1 answer

1


You cannot have access to the two folders in the same directory due to your operating system, which does not differentiate files and directories of the same name with lower or upper case letters.

A quick solution to this problem is to rename the old directory to another name, such as tmp, using the command git mv <old_name> <new_name>. After that, rename the same folder again to the name of its current folder.

This way, Git will merge the old folder with the current folder and delete the old directory, leaving only the current one. Following your example, try to run the codes below:

$ git mv folder tmp
$ git mv tmp Folder
$ git status

Browser other questions tagged

You are not signed in. Login or sign up in order to post.