Body
Overview
Documentation on the migration process for moving GitHub resources from GitHub Enterprise Cloud to GitHub Enterprise Managed Users.
Instructions
Step 1: Install the GEI extension of the GitHub CLI
- Install WinGet with “winget install --id GitHub.cli” inside CMD
- The file path will most likely be “C:\Program Files\GitHub CLI”
- Install the GEI extension with “gh extension install github/gh-gei”

- Run “gh auth login” and login with your GitHub.com (Non-EMU) account, not EMU account
- Select GitHub.com
- Select HTTPS or your preferred protocol for Git operations
- Select Yes to authenticate Git with your credentials
- Login with a web browser to authenticate GitHub CLI

Step 2: Update the GEI extension of the GitHub CLI
- Open PowerShell and navigate to the same file path where GitHub CLI is installed
- Update the GEI extension with “.\gh extension upgrade github/gh-gei”
Step 3: Set environment variables
- Create personal access tokens for both source and destination organizations
- For the destination token, go to your EMU instance
- Go to Settings -> Developer Settings -> Personal access tokens -> Tokens (classic) -> Generate a new token (classic)
- Scope the token to repo, workflow, and admin:org
- Then Generate token
- For the source token (Non-EMU), only check repo and admin:org


- Next, click Configure SSO to authorize both tokens to their respective organizations
- Set the environment variables for the tokens using these commands in PowerShell:
- $env:GH_PAT="TOKEN"
- $env:GH_SOURCE_PAT="TOKEN"
Step 4: Generate a migration script
- For a single repo migration, input the following command and replace each field with the required names of source/destination orgs, etc:
.\gh gei migrate-repo --github-source-org "SOURCE" --source-repo "CURRENT-NAME" --github-target-org "DESTINATION" --target-repo "NEW-NAME" --target-repo-visibility “{internal or private}”
- NOTE: This will begin the migration so make sure everything is edited correctly
- Queue messages and Progress messages will pop up. This will take a minimum of ~4 mins to complete.
- Once the migration is complete, you may skip the final step.
- For multiple repos, input the following command:
.\gh gei generate-script --github-source-org “SOURCE” --github-target-org “DESTINATION” --output “FILENAME”.ps1
- If you want the script to download the migration log for each migrated repository, add the “--download-migration-logs” flag.
- If there are any repositories you don't want to migrate, delete or comment out the corresponding lines.
- If you want any repositories to have a different name in the destination organization, update the value for the corresponding “--target-repo” flag.
Step 5: Migrate repositories
- For a single repo, the above command should have already run and migrated the repo to the destination org.
- For multiple repos, check to make sure the PowerShell script downloaded to “C:\Program Files\GitHub CLI” and edit any changes to the script (in Notepad)
- To run the script in PowerShell, type “.\FILENAME”
- Ex.(“PS C:\Program Files\GitHub CLI> .\FILENAME”)
- Queue messages and Progress messages will pop up. This will take a minimum of ~4 mins to complete.