gitvisual-studio-codegithubversion-control

How to remove all traces of an old GitHub repo in Visual Studio Code? ("A Git repository was found that was previously closed)


I have a project in Visual Studio Code. I had initially created a GitHub repo for it online. For various reasons I decided to delete the online repo and start over. I also deleted the local .git folder on my drive.

Now I would like to create a new repo from inside Visual Studio Code.

  1. I restart VS Code.
  2. I select my project folder.
  3. I click on the SCM icon.

I keep on getting the following message: "A Git repository was found that was previously closed". The only offered option is "Reopen Closed Repository" - I cannot create or point at a new repo.

enter image description here

Any idea as to how I can erase all history of this old repo inside VS Code? And then eventually create or associate this existing local project in VS Code to a new GitHub repo?

Thanks.


Solution

  • In same directory as user settings.json, go to workspaceStorage/, find the subdirectory there that is for your workspace, and delete the directory.

    This is a bit of a lazy and nuclear option. It will remove all memory of everything VS Code remembers about that workspace (except of course, the actual contents of the workspace). There's probably a better and more precise/surgical way, but I'm too lazy to look for it.