---
title: Planning the migration to GHE.com
date: 2026-11-09
tags: github, migration, powershell
summary: Some notes for moving our repositories from github.com to GHE.com one by one with the GitHub Enterprise Importer on Windows.
---

We are moving our repositories from github.com to GitHub Enterprise Cloud with data residency (GHE.com). The initial setup of GHE is already done and SCIM provisioning works. Besides the obvious residency change, every account will newly be company managed, more in [the licence and budget memo](/p/2026-11-09-copilot-licence-and-budgets-on-github-enterprise/).

There are only around 10 repositories to move and some will end up in different organizations. So I will migrate them one at a time with the GitHub Enterprise Importer (GEI), each with its own `--github-target-org`.

So far I have migrated one test repository and these were the steps.

## Install the GitHub CLI

```powershell title="PowerShell"
winget install --id GitHub.cli --source winget
```

Restart PowerShell afterward, so it picks up the new PATH.

## Step 1: two classic tokens

You need one personal access token for the source and one for the destination. They have to be **classic** tokens, fine-grained tokens aren't supported. Make sure you allow classic tokens in your enterprise, otherwise even the SCIM provisioning won't work.

- Source: `https://github.com/settings/tokens`
- Destination: `https://SUBDOMAIN.ghe.com/settings/tokens` (the subdomain of our enterprise)

Under Settings -> Developer settings -> Personal access tokens -> Tokens (classic) - create a token with these scopes:

| Token | Scopes |
|---|---|
| Source | `repo`, `admin:org` |
| Destination | `repo`, `admin:org`, `workflow` |

## Step 2: authorize the tokens for SSO

If SAML single sign-on applies, each token has to be authorized for it. In the token list, use *Configure SSO* next to the token and authorize the needed organizations. Do this for both tokens.

## Step 3: set the tokens and migrate

GEI reads the tokens from environment variables:

```powershell title="PowerShell"
$env:GH_SOURCE_PAT = "SOURCE-TOKEN"
$env:GH_PAT = "DESTINATION-TOKEN"
```

Install the extension.

```powershell title="PowerShell"
gh extension install github/gh-gei
```

Then migrate the repository:

```powershell title="PowerShell"
gh gei migrate-repo `
  --github-source-org SOURCE-ORGANIZATION `
  --source-repo CURRENT-REPO-NAME `
  --github-target-org DESTINATION-ORGANIZATION `
  --target-repo NEW-REPO-NAME `
  --target-api-url "https://api.SUBDOMAIN.ghe.com"
```

`--target-api-url` is required when the destination is GHE.com. `--target-repo` is how you rename the repository on the way.

Useful flags:

- `--target-repo-visibility`: `private` or `internal`. The default is private. Public isn't available in an enterprise with managed users.
- `--skip-releases`: use it if the repository has more than 10 GB of releases, since they can't be migrated.

Docs: [Migrating repositories from GitHub.com to GitHub Enterprise Cloud](https://docs.github.com/en/migrations/using-github-enterprise-importer/migrating-between-github-products/migrating-repositories-from-githubcom-to-github-enterprise-cloud).

## Before and after

- Do a **trial run** first, then the real one soon after.
- There are **no delta migrations**. Changes made during the migration are lost, so stop work in the source repository.
- Read the **migration log**, even if it says success. Check warnings and errors.
- Look through the migrated repository as a soundness check.
- Rules on the destination can block the migration, see the next section.

## Error GH013

My migration failed with this error:

```text
GH013: Repository rule violations found for refs/heads/main
```

This can be caused by a rule in the destination organization. In my case it was the rule that restricts the file size. GEI pushes the Git data into the new repository and the rules are checked on those pushes.

1. Disable the rules or policies that block it, in my case the file size restriction, in the destination organization.
2. Run the migration.
3. Enable them again afterward.

The docs also describe a less invasive way: add **Repository migrations** to the bypass list of the ruleset and set it to **Exempt**, not *Always allow*. Then the ruleset isn't evaluated for the migration pushes ([ruleset bypasses](https://docs.github.com/en/enterprise-cloud@latest/migrations/troubleshooting/setting-ruleset-bypasses-for-repository-migrations)). I have not tried that one. You need organization or enterprise admin rights for both ways.

## What does not come along

From [About migrations between GitHub products](https://docs.github.com/en/migrations/using-github-enterprise-importer/migrating-between-github-products/about-migrations-between-github-products).

Migrated: git history, pull requests, issues, milestones, wikis, Actions workflows, commit comments, branch protections (not every rule, force pushes for example), topics, repository settings and releases. Webhooks are migrated but have to be re-enabled.

Not migrated:

- Actions secrets, variables, runners and workflow run history.
- Git LFS objects, which need a follow-up push.
- Packages, Projects, rulesets, GitHub Apps and tag protection rules.
- Fork relationships, stars, watchers.
- Signing keys, SSH keys and tokens of users. Web-signed commits may show as "Unverified".

So there will be a checklist to go through for each repository: secrets, variables, runners, LFS, apps.

## Mannequins

There is an option on GEI to reclaim the commits of users who don't exist in the destination organization. That is the case for us, since all users are now managed accounts. The GEI docs call them mannequins, placeholder users. The commits are attached to them until I reclaim them.
Sounds interesting, but I have not tried this part yet.

From the docs: [Reclaiming commits from mannequins](https://docs.github.com/en/enterprise-cloud@latest/migrations/using-github-enterprise-importer/reclaiming-commits-from-mannequins).

```powershell title="PowerShell"
gh gei generate-mannequin-csv --github-target-org DESTINATION --output mannequins.csv `
  --target-api-url "https://api.SUBDOMAIN.ghe.com"
# fill in the target login of each person
gh gei reclaim-mannequin --github-target-org DESTINATION --csv mannequins.csv --skip-invitation `
  --target-api-url "https://api.SUBDOMAIN.ghe.com"
```

- Reclaiming is not automatic. By default, the member has to accept an invitation by email.
- `--skip-invitation` works only with managed users and reclaims right away. That is the one I want.
- The managed user must already be a member of the organization, so the provisioning from the identity provider has to come first.
- Commits are matched by email, not by mannequin. With managed users only commits with the *primary email in the identity provider* are attributed. Commits with a GitHub `noreply` address can't be reattributed.
- Reclaiming gives no repository access. That is separate.

We will see if this works for us. If not, it is not deal-breaking, since the commits are still there and attributed to the mannequin. It is just not as nice as having them attributed to the real person.