How To Clone An Existing Git Repo In Azure Repos

Before reading this article, please read the previous articles so that you can understand Azure DevOps. The list of previous articles is provided below.

In my previous article, we learned how to add our code to Azure DevOps Repos. This article will teach us how to clone an existing repository and work collaboratively with the Team.

Create a complete local copy of an existing Git repo by cloning it. Cloning a repo downloads all the commits and branchesin the repo and sets up a named relationship with the existing repo you cloned. Use this relationship to interact with the existing repo, pushing and pullingchanges to share the code with your team.

How to clone the URL to your repo ?

Open your Azure DevOps accountand choose Repos and Files as shown below.

Fabrikam

From the upper right corner, click Clone and from the pop-up, select and copy the URL.

Clone repository

Go to your Visual Studioand from the Team Explorer tab, click on "Connect to Project", as shown in the below screen.

Connect to project

It will ask you to log in, so just enter your credentials and log in.

Visual studio

Enter password

On the "Connect to Project" dialog, select the repo you want to clone from the list. Here, Ihave selected csharpcorner.visualstudio.com and 'GitDemo' repo.

Connect to a project

Next, click "Connect".

Click to connect

Enter the URL that you have copied from the clone section from Azure DevOps paste it into the Clone Repository section and click on the Clone button, as shown in the below screen.

Team explorer home

It will clone your existing code and project so that you can work with your team remotely.

Git Demo

You can see thatmy project solution is there on the local repo path.

Web app git demo

Now, from the Solution Explorer, make changes in files. I have made changes in About.cshtml.

About cs html

About cs

Commit your changes by right-clicking on afile.

Commit

Add the comments related to these changes so that you can track that in Azure Pipelines.

Changes

Sync your changes on the server by clicking on 'Sync'.

Click on sync

Push the master Brach by clicking on Push.

Clicking on push

Synchronization

Now, go to your Azure Pipeline and check all the commits. You can see the changes inComment number, Message, and Author name.

Commits

I hope you like this post. In my next article, we will learn what Branch and Merge are in Azure DevOps.

Reference

  • https://docs.microsoft.com/en-us/vsts/repos/git/clone?view=vsts&tabs=visual-studio

If you want to read more about Azure DevOps, the next articles in this series are listed below.