How to undo a Repo creation on a User file

Recently I have been trying to use the Github desktop app to create a repo on my local machine. However, I kept getting the error stating that the selected folder/location already appeared to be a repo. I found out the I had accidentally made my user folder a repo itself and I have been searching for a way to try and fix it to no avail. I am on the fence about any method of deleting the “repo” because I am concerned that it would delete all my files. If it helps at all, the directory to the file is:


and attempting to create a repo and any level lower than that generates errors. Any help would be greatly apricated.

If C:\Users\gamer is the accidental repository, there is a C:\Users\gamer\.git directory, which holds the repository data. Delete that to get rid of the repository.

:warning: Warning: Deleting the .git directory does not delete your files, but it deletes all the history and configuration of that repository. Make sure you have the right one, and if there’s anything you want to keep (e.g. old versions of some files) extract it first.

1 Like

Thanks! I was able to use the the following command and committed it.

git rm -r C:/Users/gamer

That was able to remove the repo and I was able to push a change I made on my desktop to Github.

For any future reference: git rm will actually delete worktree files (unless --cached is used). Don’t use it to remove a repository.

1 Like