{{'2017-02-07T11:08:51.9181055Z' | utcToLocalDate }}
Simon Sabin

VSTS Git Repos no longer show as connected in Visual Studio

imageI hit something this week where one of my Git repos showed as disconnected in Visual Studio and Team Explorer was showing me the option to clone the repo. Which clearly I didn’t want to do as it was already cloned. You can see in the picture that I have the repo locally (at the bottom) but in the list of projects I get the clone button.


The root cause of this was that VSTS has been cleaning up an old artefact of its TFS history. For on premise TFS you have the ability to have collections, and one TFS can have multiple collections. Its a level of isolation above a project and not one I’ve seen used much.

The impact is that URLs were of the form  http://<TFSServer>/<collection>/… there is a default collection that is accessed by http://<TFSServer>/defaultcollection/….. you can read about collections here


For VSTS, team project collections don’t really exist, instead you have an account but the legacy meant that URLs were of the form http://<account>


Over the past year they’ve been removing defaultcollection from the URLs and you can read more here


What seems to have happened is that they’ve now removed defaultcollection from the URLS for the GIT repos. What this means is that the remote defined locally contains defaultcollection but the one returned by VSTS doesn’t and thus Visual Studio doesn’t match them up and thus doesn’t think the repo is cloned.


To check this out you can run the following from your favourite command line from within the git repo.

git remote –v

This returns all remotes and their URLS



You can see the URL has defaultcollection in it.

If I tried to clone the repo in VS you will see the clone URL doesn’t have defaultcollection in it.



The solution is easy change the URL for your remotes in GIT. this is done with

git remote set-url <remote> <url>

I’ve written a handy powershell script that will iterate over a set of repos

comments powered by Disqus