Migrating Azure DevOps repositories into GitHub Enterprise Cloud

RamanaReddy V
4 min readJan 20, 2024
ADO to GitHub

This blog post provides a comprehensive guide on how to complete the entire process of migrating from Azure DevOps to GitHub Enterprise Cloud using GitHub Enterprise Importer. We can run our migrations using either the GitHub CLI or the API. For now, I’m focusing on the API.

GitHub Enterprise Importer is a highly customizable migration tool designed to help you move our enterprise( i.e. Here ADO Repositories) to GitHub Enterprise Cloud. It can be used to migrate your Git history, work items, pull requests, comments, and more from major DevOps services.

Prerequisites:

  1. GitHub account with the necessary permissions to create repositories within a Organization.
  2. Azure DevOps account with the necessary permissions to access repositories.
  3. Personal Access Token (PAT) for both GitHub and Azure DevOps.
  4. Create a new organization or use an existing organization on GitHub.

Here are the steps to follow:

  1. Pull the list of all repositories from a project in Azure DevOps and capture the webUrl attribute of each repository item to use as the source repository URL for the further migration process.
Get All repo’s

2. Retrieve the GitHub organization ID (OwnerId) using the GitHub GraphQL API.

GitHub GraphQL allows developers to retrieve data from GitHub in a more flexible and efficient way than the traditional REST API. The GitHub GraphQL API offers more precise and flexible queries than the GitHub REST API, and it lets you replace multiple REST requests with a single call to fetch the data you specify.

Organization ID

The login parameter specifies the login of the organization whose ID you want to retrieve. The query returns an object that contains information about the organization, including its ID.

3. Create a migration source on GitHub using a GraphQL request for migration purposes.

To create a migration source on GitHub using a GraphQL request, you can use the createMigration mutation in the GitHub GraphQL API. The createMigration mutation creates a new migration that can be used to migrate data from an external source(i.e. ADO) to GitHub.

Migration source

4. Start the repository migration using the migration source information and the source repository URL (webUrl).

To start the repository migration, you can use the startRepositoryMigration mutation in the GitHub GraphQL API. The startRepositoryMigration mutation starts a new migration for a repository and returns the migration ID.

Repo Migration

5. We can retrieve the status of a migration, whether it has succeeded or failed, along with the reason for the failure, based on the migration ID.

Migration status

Query retrieves information about a specific migration, including its status and any failure reasons. The response will contain the state of the migration in the state field, which can be either SUCCEEDED, FAILED, or IN_PROGRESS.

6. When you complete the migration from Azure DevOps to GitHub Enterprise Cloud, you can log in to your GitHub account with a specific organization and view the migrated repositories. The migrated repositories will be stored in a new repository that will hold the migration log.

Migration Log

For More detailed way :

REF:

  1. https://docs.github.com/en/migrations/using-github-enterprise-importer/understanding-github-enterprise-importer/about-github-enterprise-importer
  2. https://docs.github.com/en/migrations/using-github-enterprise-importer/migrating-from-azure-devops-to-github-enterprise-cloud/migrating-repositories-from-azure-devops-to-github-enterprise-cloud

--

--