How to remove duplicate README files with different cases from GitHub repository?

I accidentally created two README files in my GitHub repo - one named README.md and another named readme.md. This happened because of case sensitivity differences between my local system and GitHub.

Now both files exist in the repository and it’s causing issues with my GitHub desktop client. The app seems to get mixed up about which file to display or use. I noticed that GitHub’s web interface doesn’t seem to have a straightforward delete button for files.

What’s the best way to remove one of these duplicate README files? I want to keep just one version but I’m not sure how to safely delete the other one without messing up my repository.

just rename the one u want to keep first - that way u won’t accidentally delete the wrong one. edit the keeper file to something like README_main.md, commit it, then safely delete the other readme. u can always rename it back to README.md later. no confusion, no lost content.

You can do this right in GitHub’s web interface - no command line needed. Just go to the file in your repo, click on it, then hit the trash icon above the content. GitHub will let you commit the deletion right there. I’ve dealt with the same case sensitivity headaches when switching between operating systems, and this beats juggling desktop clients and terminal commands. Once you delete it, GitHub Desktop should sync up and stop showing those conflicting files.

This happened to me on a team project where people were using different operating systems. Git is case-sensitive but some filesystems aren’t, which causes this mess. Before you delete either file, check if they actually have different content - sometimes unique info gets split between the duplicates. You can compare them side by side in GitHub’s web interface first. If they’re identical, the git rm approach mentioned earlier works fine, but pull the latest changes first. Also, you might need to clear your browser cache afterward if GitHub’s interface still shows the old file.

I’ve faced the same problem with case-sensitive duplicate files on GitHub. To resolve it, first ensure that your local repository is updated. Then, temporarily move one of the README files out of your repository folder. This action will stop Git from tracking it when you commit the change. After pushing this to GitHub, check the web interface to confirm that only one README file remains. Next, you can safely delete the relocated file outside the repo to avoid complications with git rm. This method provides a backup just in case.

Had this exact problem last year switching from Windows to Mac for dev work. Just use git commands directly instead of messing with GitHub’s interface. Clone your repo locally if you haven’t already, then run git rm readme.md to delete the lowercase version (assuming you want to keep README.md). Commit it with git commit -m "Remove duplicate readme file" and push back to GitHub. Worked perfectly for me - GitHub desktop stopped getting confused about which file to show. Just make sure you specify the exact filename with correct case in git rm, or you might delete the wrong one.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.