In previous blog post, we learned how to do baby steps for implementing IaaC. We learned how to use ARM templates, Git and Visual Studio to code your subnets in the Azure. Now, there is no doubt that Git has taken over the world for source code management. And while it is good for managing versions of source code, those versions and details are confined to your local machine. If someday your local machine goes kaput, its all in water. For that, you need to sync your changes to a centralized source code management system. Also having centralized source code management allows more than one person to work on the same repository.
This is where Visual Studio Team Services come into play. It is a Software as a Service aka SaaS offering from Microsoft which does a whole lot of other things as well. In this blog post, we’ll learn how to sync your local source code along with all the commit history with the Visual Studio Team Services.
Do note that you can use any git based centralized repository like GitHub, BitBucket, etc by using the same principles as mentioned in this blog post.
First of all, we need to sign-in inside Visual Studio Team Services or VSTS with an account. If you don’t already have a one, you can easily sign up for one. Once we have signed-in, we’ll create a new project from Dashboard:

It will ask for few basic details such as what type of project management and repository type you would need etc. Fill in the details as shown:

It will automatically create a source code repository with same name as the project, by default. If you already have a repository, to which you would want to push your changes, you can skip above steps. We only need to copy the repository URL from the source code repository created and keep it for later.
Now, we’ll need to open existing Visual Studio project and then select team -> manage connections from the tabs as shown below:

Once its selected, we need to provide sign in information for the VSTS subscription. Now, from the Team explorer pane, select settings -> Repository settings -> Remote section, select add and provide details for the centralized repository and save it:

Make sure to select the name as origin.
Also, we need to go to Team explorer pane -> settings -> global settings and select check box for ‘Enable push –force’ and save it. This is needed so that first time, we can push forcefully source code into remote repository.
Now, from the team explorer pane, select ‘Sync’ and then select Push:

Once the push is complete, you can then see the source code is successfully uploaded to the VSTS:

This will sync all your commit history into VSTS and from then, you can manage your changes from both inside VSTS as well as Visual Studio.
[…] Sync local source code and commit history with Visual Studio Team Services […]
LikeLike
[…] have source code ready so that we can upload it to VSTS. If you have the source code, you can use steps mentioned here to upload your code to VSTS. For this blog’s case, we’ll be using source code from Github repository: […]
LikeLike
[…] Before, we can do the build and release using Azure Pipelines, we’ll need to upload source code to Azure Repos. For steps on how to upload source code to Azure Repos using Git, refer here. […]
LikeLike
[…] Before, we can do the build and release using Azure Pipelines, we’ll need to upload source code to Azure Repos. For steps on how to upload source code to Azure Repos using Git, refer here. […]
LikeLike