These instructions explain how to migrate a repo from GitHub Enterprise Server to GitHub Enterprise Cloud using the gh gei
CLI when either:
- (a) you want to use an unsupported blob storage provider; or
- (b) you want to use a supported blob storage provider with different authentication
The following instructions assume that you have curl
and jq
installed. There are available for Linux, macOS and Windows Subsystem for Linux (WSL).
- Make a note of your GitHub Enterprise Server hostname (e.g.
github.acmecorp.com
) and expose it as theGHES_HOST
environment variable:export GHES_HOST=github.acmecorp.com
. - Make a note of the GitHub Enterprise Server organization that owns your origin repo, and expose it as the
GHES_ORGANIZATION
environment variable:export GHES_ORGANIZATION=engineering
. - Make a note of the name of the repo you are migrating in GitHub Enterprise Server, and expose it as the
GHES_REPO
environment variable:export GHES_REPO=webapp
. - Create a personal access token (PAT) with the
read:org
andrepo
scopes and expose it as theGITHUB_TOKEN
environment variable:export GITHUB_TOKEN=xxx
. - Start generating your migration archive by running
export MIGRATION_ID=$(curl https://$GHES_HOST/api/v3/orgs/$GHES_ORGANIZATION/migrations -X POST -H "Authorization: Bearer $GITHUB_TOKEN" -H "Content-Type: application/json" --data "{ \"repositories\": [\"$GHES_REPO\"] }" | jq ".id")
. - Repeatedly run
curl https://$GHES_HOST/orgs/$GHES_ORGANIZATION/migrations/$MIGRATION_ID/archive -H "Authorization: Bearer $GITHUB_TOKEN"
until it returns a URL. - Download the archive from the URL in step 6 by running
curl <url> --output $GHES_REPO.tar.gz
- Upload your archive to your chosen blob storage provider and generate a short-lived URL (e.g. AWS S3 presigned URL or an Azure Blob Storage SAS URL)
- Kick off your migration using the GEI CLI, passing in the blob storage URL URL. Your command will look something like this:
gh gei migrate-repo --github-source-org $GHES_ORGANIZATION --source-repo $GHES_REPO --github-target-org Deep-Space-9 --git-archive-url <URL from step 8> --metadata-archive-url <URL from step 8> --wait