DevOps | Scripts | Automation

Azure DevOps

Importing repository in Azure DevOps

Sometimes you need to work on a different repository which is not in your project or organization in Azure DevOps. For example, your source code resides in a separate repo of the organization (Say OrgA) and you need to run a pipeline that is in a different organization (Say OrgB) by accessing the repo of OrgA in that case pipeline in OrgB won’t recognize the repo of OrgA.

There are multiple ways to solve this problem.

  • Importing Azure Repository.
  • Forking Repository (from OrgA to OrgB).
  • Cloning repository (Downloading and uploading repo to your organization).

Here, we will take the Import Repository option but before we dig further, to import the git repository, you must be a member of a project administrator group in Azure DevOps.

https://docs.microsoft.com/en-us/azure/devops/repos/git/set-git-repository-permissions?view=azure-devops

Follow the steps to Import the repository in Azure DevOps.

  1. Open your Project Repository to which you want to import and click on File.
Files in Repo

2. From the dropdown, select Import Repository.

Import Repository

3. On the Import repository page, provide Clone URL of the organization or project you want to import as below and click Import.

The URL should be https://dev.azure.com/{yourorganization} or if you have a specific repository to import then provide https://dev.azure.com/{yourorganization}/_git/{repoName}

Examples:

https://dev.azure.com/MyOrganization

https://dev.azure.com/MyOrganization/_git/Azure_Pipeline

Import a Git Repository

6. If the accessing repository requires any authentication, you need to use the checkbox “Requires Authentication“. It generally requires importing a secure repository that you don’t have access to. You can use the PAT token instead of a password.

Repository Authentication

5. Once the repository is imported, you can see the imported repository in the drop-down, select that repository and you are able to access the source code.

Imported Repository

3 thoughts on “Importing repository in Azure DevOps

Comments are closed.