4 Answers
Visual Studio 2015 stores the list of GIT Repositories in the Registry:
Computer\HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\TeamFoundation\GitSourceControl\Repositories

- 319
- 1
- 7
-
that path is not present in my system – amit jha Sep 24 '17 at 09:35
-
Are you looking in the registry using the REGEDIT.EXE program? – David Kujawski Sep 25 '17 at 14:29
-
what part of the path are you missing? – David Kujawski Sep 27 '17 at 21:44
-
Look at my path again - it is in the "14.0" folder, the screenshot you sent is of "15.0" folder NOTE: the 14.0 folder is for VS 2015, the 15.0 folder is for VS 2017 – David Kujawski Sep 28 '17 at 13:03
-
i am using 2017, and also in 14.0, there is only "Setup" – amit jha Sep 28 '17 at 14:25
-
This question specifically asked for Visual Studio 2015!! My answer is correct for VS 2015 - sounds like you don't have VS 2015 installed so you aren't seeing the registry entries. I've done this for VS2017 as well, but you'd need to ask a new Stack Overflow question. – David Kujawski Sep 28 '17 at 18:49
-
at that time 2015 was latest. now 2017 is latest. – amit jha Sep 29 '17 at 08:37
-
VS 2017 changed the registry hive it uses. There is now a binary file within the visual studio config folder that is a registry hive file that stores this information. – ILMTitan Jan 02 '18 at 21:08
-
Because it's a binary file, now we can't get any useful information from that file? Any tool that can decipher that file? – Tony_Henrich Jul 02 '18 at 22:58
I'm working with VS2017 and after a bit of digging, I think I may have found where Visual Studio is storing the information. Go to %AppData%\Microsoft\VisualStudio\15.0_{instanceId}\Team Explorer\TeamExplorer.config.
That file has information like the following in it:
<!--This configuration file specifies the previously-configured connection details for Team Foundation Server.-->
<server_list>
<server url="http://mytfsserver:8080/tfs" current="yes">
<collection guid="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx" url="http://mytfsserver:8080/tfs/defaultcollection" name="mytfsserver\DefaultCollection" current="yes" autoload="yes">
<project projectUri="vstfs:///Classification/TeamProject/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx" name="MyTeamProject" capFlagsScc="1" supportsGit="yes" active="yes" team="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx">
<repository type="2" name="MyGitRepo" guid="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx" activeClone="C:\Repos\MyGitRepo" isFork="False" />
</project>
</collection>
</server>
Based on this, you can tell that MyGitRepo is stored in C:\Repos\MyGitRepo. The best way I can find to get the Visual Studio instance ID is by calling:
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property instanceId

- 221
- 2
- 5
As far as I know, Visual Studio likely does not have much to do with where Git is storing its metadata. Git maintains a hidden folder called .git
at the root level of every local repository. In it is contained all the objects, refs, blobs, hooks, etc. which get used in Git.
Following the interface which Git exposes, if you want to see the files corresponding to a local branch you have, you can checkout that branch, or possibly checkout individual files of interest.

- 502,043
- 27
- 286
- 360
-
But when we do "Refresh" on "Team Explorer - Connect" Document window, it refreshes/ finds the git repositories by digging all the `.git` folders in the paths specified under "Local Git Repository". So, I thought it may be saving somewhere. I searched the registry, but wasn't able to get a clue. – amit jha Oct 11 '16 at 09:51
Well. It seems that Visual Studio 2019 has moved this information yet again. It's now in the VS private registry. Based on this post and this post, I used the following code snippet to find the local Git repositories:
const string GitRepoRoot = @"TeamFoundation\GitSourceControl\Repositories";
ExternalSettingsManager ext = ExternalSettingsManager.CreateForApplication(@"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe");
SettingsStore store = ext.GetReadOnlySettingsStore(SettingsScope.UserSettings);
var keyNames = store.GetSubCollectionNames(GitRepoRoot);
foreach (var key in keyNames)
{
Console.WriteLine(store.GetString($"{GitRepoRoot}\\{key}", "Name"));
Console.WriteLine(store.GetString($"{GitRepoRoot}\\{key}", "Path"));
}

- 221
- 2
- 5