Visual Studio new Project with wrong git repository

Viewed 521

When I create a new project, I connect it with the git source from another existing project, this one is totally new and I don't know why it takes the sources control from the other ones without asking or anything.

For example, I have my project "A" on my computer, connected with git, today I tried to create project "B", and from the beginning, it connects with the git from the project "A", and says that I have tons of changes.

How could I avoid that o change it?

3 Answers

You can delete the .git folder or you can simply change the repository URL as below
Changing a remote repository's URL
The git remote set-url command changes an existing remote repository URL.

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

Looks like there's a .git folder in your new project directory. Try deleting that and it should work when you connect it again.

I had the same issue and I know how to solve it. For some reason, VSC (Visual Studio Code) has the wrong path for the git folder.

How to fix it:

1. When you hover your mouse here:

enter image description here

you will see that path (mine pointed to the whole desktop). Delete it in explorer.

2. In my case, that was all I needed to do. After that VSC found a proper git file.

Related