Note
Enterprise Live Migrations is in public preview and subject to change.
Tip
As you follow this guide, you can refer to the Enterprise Live Migrations CLI reference for more detailed usage information. If you encounter errors, see Troubleshooting live migrations from GitHub Enterprise Server to GHE.com.
Prerequisites
Make sure you're ready for your migration. See Preparing for your live migration from GitHub Enterprise Server to GHE.com.
1. Create access tokens
You must authenticate with a personal access token (classic) for both the source and destination of the migration. For detailed instructions, see Managing your personal access tokens.
Make a note of both tokens, as you will need them in the next step.
-
Create a personal access token (classic) on GitHub Enterprise Server with the following scopes.
repoadmin:orgadmin:repo_hookadmin:org_hook
-
Create a personal access token (classic) on GHE.com with the following scopes.
repoworkflowadmin:orgadmin:repo_hookadmin:enterprise
-
If single sign-on is enforced on the target organization on GHE.com, authorize the GHE.com token.
2. Configure GitHub Enterprise Server
You must set some configuration on the GitHub Enterprise Server instance before performing a migration. These configuration values apply to all ELM migrations. Developers on GitHub Enterprise Server may experience a brief downtime when you apply the new configuration.
-
Access the GitHub Enterprise Server administrative shell over SSH. See Accessing the administrative shell (SSH).
-
Set the following configuration variables with
ghe-config.For example:
ghe-config app.elm-exporter.enabled trueVariable Set this to... app.elm-exporter.enabledtrueapp.elm.internal-webhooks-enabledtrueapp.elm-exporter.webhooks-loopback-address-enabledtruesecrets.elm-exporter.migration-target-urlThe API URL for your destination enterprise (for example: https:/). Do not include a trailing slash at the end of the URL./ api.octocorp.ghe.com secrets.elm-exporter.migration-target-tokenThe access token you created for GHE.com. secrets.elm-exporter.source-tokenThe access token you created for GitHub Enterprise Server. secrets.elm-exporter.source-userThe username associated with the GitHub Enterprise Server token (for example: ghe-admin).app.migrations.enabledIf you don't already have migrations enabled on the instance, you must set this to true. -
Apply the configuration.
Shell ghe-config-apply
ghe-config-apply
3. Set required environment variables
When the configuration has been applied, and before starting a migration, set required environment variables. For example:
export API_URL='http://localhost:1738'
Important
Copy the values for API_URL and MIGRATION_MANAGER_HMAC_KEY verbatim. The other variables are specific to your environment.
| Variable | Required value |
|---|---|
| API_URL | http:/ |
| MIGRATION_MANAGER_HMAC_KEY | $(ghe-config secrets.elm-exporter.elm-exporter-hmac-keys) |
| MIGRATION_TARGET_URL | The API URL for your destination enterprise (for example: https:/). Do not include a trailing slash at the end of the URL. |
| MIGRATION_TARGET_TOKEN | The personal access token (classic) for GHE.com |
Any of these values can also be provided as CLI flags on any elm command, which will take priority over the variables. For example: --api-url http://localhost:1738.
4. Create a migration
Create a new migration by specifying the source and target repository details. --pat-name must be set to system-pat as a static value. The other values are placeholders specific to your environment.
Note
The target-org can be new or existing. If the target organization doesn't already exist, it will be created during the migration. However, no settings from the source organization will be migrated.
elm migration create \ --source-org EXISTING-GHES-ORG \ --source-repo EXISTING-GHES-REPO \ --target-org GHEC-ORG \ --target-repo NEW-GHEC-REPO \ --target-api GHEC-API-URL \ --pat-name system-pat
elm migration create \
--source-org EXISTING-GHES-ORG \
--source-repo EXISTING-GHES-REPO \
--target-org GHEC-ORG \
--target-repo NEW-GHEC-REPO \
--target-api GHEC-API-URL \
--pat-name system-pat
For example:
elm migration create \
--source-org my-ghes-org \
--source-repo my-ghes-repo \
--target-org my-dr-org \
--target-repo my-dr-repo \
--target-api $MIGRATION_TARGET_URL \
--pat-name system-pat
Optional flags:
--start: If you're ready to start the migration immediately.--target-visibility: Migrated repositories are created with internal visibility by default, but you can specifyprivate.
Save the migration ID
You should see a response like the following:
{
"migrationId": "2b5c9eae-b5da-4306-ab04-2a29cc2b7cb9",
"expiresAt":