4

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 

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

I just close and open the Vs Code and start working again but it just put some files as untracked I don't know why.
3

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.