I'm using Visual Studio 2015 and I'm trying to script the steps involved in getting a new VS instance up and running for a new dev. We are using Git for source control and want to use Visual Studio's built-in Git integration. The part I'm trying to automate is cloning the repository to a local directory and having it show up under "Local Git Repositories" in the Team Explorer. The same thing I can do manually with in the GUI by clicking "Clone Repo", I just to be able to do it from the command line. Obviously I can clone the actual repo from the command line just using git, the hard part here is getting it to show up in the Team Explorer list. Anyone know how to do this? Or know where the list of Git repos VS uses is stored? I could edit the config file and add the new repo if I knew where these settings were stored, but I can't seem to find it anywhere.
You do not have to clone via Visual Studio in order to get the local repository to show up. You can add an already existing local repository via the "Add" link in the Team Explorer Connect page. Local repositories are also added if you open a solution that is contained in a Git repository.
One option - while not completely automated - if adding the local repositories via the "Add" link is acceptable, is that the default path that shows up when you click on the "Add" link can be controlled from the Team Explorer Git Settings (Global Settings) page, under the Default Repository Location.
The repository information is stored in the registry. One place that you might look for examples is in the GitHub Visual Studio plugin in their RegistryHelper class. However - this is a bit of information internal to the implementation and is not a supported public API point, and is likely to break in the future. For instance, I do not think directly accessing the registry will work for Visual Studio 2017.