Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 Local Git Repo Incorrect Path

I'm having trouble with Visual Studio 2017 (Community Edition), trying to publish my new solution to Visual Studio Online.

Visual Studio will not let me Push the solution before I commit changes. However, when I go to Changes in Team Explorer, Visual Studio is trying to commit my entire C:\Users\Username folder and all of it's sub-directories (34,967 Changes) as in the screenshot below:

enter image description here

I have been trying for hours now, have even tried uninstalling and re-installing Visual Studio but I can't figure out how to fix this problem.

Could somebody please explain how to simply publish the solution that I'm working on to Visual Studio Online?

like image 967
Michael Hennigan Avatar asked Feb 22 '26 20:02

Michael Hennigan


2 Answers

I think you have initialized the git repository in the user folder instead of the project folder.

To fix that, delete the '.git' folder that is located in the user folder (it could be hidden by default).

Then initialize the git repository in the good folder.

like image 102
Philippe Avatar answered Feb 25 '26 11:02

Philippe


It’s not necessary to locate your local repo to C:\Users\Username\Source\Repos\reponame (it's default path but you can change it when cloning a repo). You just need to make sure VS is connect with the right git repo for you are working. Steps as below to trouble shooting your issue:

  1. Please make sure you have cloned your VSO git repo. And the default local repo is cloned into C:\Users\Username\Source\Repos\reponame. But you can change the path in your need.

    enter image description here

  2. Check the local git repo you are working for.

    VS -> Team Explorer -> Manage connections -> the bold repo is which you connect now (such as C:\Users\TFSTest\Source\Repos\Git2is the current working local repo).

    enter image description here

  3. Create solution for the right path

    You can create solutions from Team explorer - New (the location is the current local repo path C:\Users\Username\Source\Repos\reponame by default) or you can create by File - New - project (the default locations is like c:\users\Username\documents\visual studio 2017\Projects). No matter how you create a solution, you must make sure the Location is your local repo path (C:\Users\Username\Source\Repos\reponame) and the Create new Git repository is unselected.

    enter image description here

Now VS will only show the changes for the new solution you created.

like image 31
Marina Liu Avatar answered Feb 25 '26 13:02

Marina Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!