In this article, we are going to learn how to import a git repository from one project to another project.
Introduction
Sometimes, when you want to start a new assignment, you may want to copy from an existing codebase instead of starting all over again. In order to solve this, Azure DevOps allows us to import the repository from within the project or across other projects.
Below are a few simple use cases of when you would like to import a git repository into an Azure DevOps Project
- Migrate a Repository from GitHub to Azure DevOps
- Copy a Repository from one Azure DevOps project to another project within the same Organization
- Copy the repository across two different Organizations.
In this article, we will discuss about the simplest use case explained in the item #2 above where we copy the repository from a source project to a target project within the same organization.
Prerequisites
- Create two projects Source project and the Target Project.
- Create a git repository in the Source project
Import Git Repository
Navigate to the Source Project which you would like to copy. As shown below, click on the Repo name, click on the Clone button and then copy the URL of the repo and save it a notepad.

Next step is to click on the Generate the Git Credentials, copy the Username and the Password as shown below

We are going to use this URL, username and the password while importing the repo from another project.
Let’s now navigate to the Target Project where you would like to import the git repo.
Navigate to the repo section, click on the arrow mark (Step1 below) and then select the Import Repository (step2 below) which opens up the Import a Git Repository popup, where you provide the Clone URL (step3) and then click on the Requires Authentication checkbox (Step4), provide the Username and Password (Step 5 & 6) and finally click on the Import button (step7).

Once you hit the Import button, it takes some time to process and after a few moments, you will see the Import Successful message as shown below.

Click on the Click here to navigate to code view to view the repo which is imported into the target project.
Summary
In this article, we have learnt how to import and existing repo from an source project to another project.
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups