Reputation: 67345
A few versions back, Visual Studio started using C:\Users\Jonathan\source\repos as the default project folder (instead of C:\Users\Jonathan\Documents\Visual Studio 2019\Projects). I prefer the old location under Documents, but I decided to just accept the newer location because I figure that is more likely to avoid conflicts, avoid having to change it with each new release and just generally the path of least resistance moving forward.
Now I want to create a GitHub repository. But the default Local path is the same path where the project is stored! So without changing this path, I get the following error:
Repository with same name already exists at this location.
Obviously, I can change this path. But I'm trying to go with Microsoft's recommended folder locations to avoid conflicts. And so it seems ironic that I've run into a conflict using these locations!
Questions:
Upvotes: 4
Views: 6714
Reputation: 8637
VS has default project location: Tools -> Options -> Project and Solutions -> Locations:
and default location for git repos: Team Explorer -> Settings -> Git -> Global Settings:
and they should be the same because project and local repo should be in the same folder.
But you can change them what I did. You don't need to follow default MS recommendations, just select folder convenient for you.
And this answer is correct. Just select your Solution, right click and press Add Solution to source control...
Upvotes: 3
Reputation: 2047
Git needs a local repo. VS is trying to create a local repo, but you want to use the existing repo.
How do I do ?
File => Add to Source Control
View => Team Explorer
Sync
It will not ask to create a new repository.
Did I answer your question ?
You are dealing with "git clone" and git clone only works with an empty folder then its ok if it defaults to the projects folder, lets clone the project.
If you already have the project in your computer and just want to push the code, then you should init your local git repo in the project folder, add the github remote and push the code into the remote repository.
Here you have some docs.
Upvotes: 3
Reputation: 30
I had the same problem with Visual studio 2017 community edition. I ended up doing this.
For new projects
for other projects
Upvotes: 0