Visual Studio can connect to an Azure DevOps project through Team Explorer by adding a new Team Project connection.
By connecting to a Team Project (hosted in Azure DevOps), one is able to see the Work Items, Builds and more:
There is a problem, however, when the aforementioned project in Azure DevOps is not using Azure DevOps internal Git repository, but instead, is using an external GitHub repository.
In Azure DevOps, this external GitHub repository was set up in: Project Settings --> Boards --> GitHub connections and the units of work (e.g. tasks) are successfully linked to commits in the GitHub repo.
Visual Studio only provides support for the Team Project's internal Git repository, which is empty because an external GitHub repository is being used instead.
If Visual Studio is connected to the GitHub repository directly, then all Git commands are available, but the Team Project link is lost and things like "Work Items", "Builds", etc. are no longer available. On the other hand, by connecting to the Azure DevOps Team project these are available, but the source code repo (in GitHub) is no longer available.
Both options seem to be mutually exclusive. Is there a way to be able to connect to an Azure DevOps Team Project while using the external GitHub repository at the same time (instead of Azure DevOps unused internal Git repository)?
There is a bit of a trick... A lot of functionality in Visual Studio depends on the origin
remote. If there are multiple remotes, Visual Studio will light up the functionality of the provider that is referenced by the origin
remote. So when your local repo has multiple remotes, one to GitHub and one to Azure Repos, the additional functionality of the provider in the origin
remote will activate. You can still push/fetch/pull from either remote in this case.
So:
Or:
github
origin
You can then ignore the origin
remote. It purely serves Visual Studio to tell it to activate the Azure Boards and Azure Pipelines features.
This should let Visual Studio think the project is hosted primarily on Azure DevOps and you'll be able to push and pull on GitHub as well.