'Vscode source control doesn't recognize my repo

I have a local repo which was linked to a old remote repo. I made a new repo on GitHub and ran this in the folder

git remote set-url origin <new repo url>

where the url is the new repo. Then I ran

git push -u origin master

Which pushed everything to my new repo. If I run

git remote -v

I get the correct repo location. But vscode does not seem to recognize the repo. It is saying the folder currently open does not have a git repo. Why is this? I tried running git init which prints

Reinitialized existing Git repository in <folder name/.git/>

But this doesn't do anything?

What can I do to make vscode's source control see my repo again? I have uncommited code, so not everything is pushed so I can't simply clone the repo.

Edit:

When I try to commit I get the following error

$ git commit -a -m "Renamed the repo"
fatal: this operation must be run in a work tree 


Solution 1:[1]

I had to go into my .git/config and update the worktree field to the new folder location.

Solution 2:[2]

I needed to run VS code as administrator (on Windows)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anonymous-dev
Solution 2 Dharman