Step 1: Install the ADO2GH extension of the GitHub CLI
GitHub Enterprise Importer is a collection of extensions for GitHub CLI. If this is your first migration, you'll need to install GitHub CLI and the ADO2GH extension.
-
Installez le GitHub CLI.
- Pour obtenir des instructions d’installation pour GitHub CLI, consultez le dépôt GitHub CLI.
- Si vous avez GitHub CLI déjà installé, exécutez
gh --versionpour vous assurer que vous exécutez la version 2.4.0 ou ultérieure. Si vous avez une version antérieure, consultez le GitHub CLI référentiel pour obtenir des instructions de mise à niveau.
-
Installez le ADO2GH extension.
Shell gh extension install github/gh-ado2gh
gh extension install github/gh-ado2gh -
La ADO2GH extension of the GitHub CLI est mise à jour chaque semaine. Pour être sûr d’utiliser la version la plus récente, mettez à jour l’extension.
Shell gh extension upgrade github/gh-ado2gh
gh extension upgrade github/gh-ado2gh
Dès que vous avez besoin d’aide sur ADO2GH extension, vous pouvez utiliser l’indicateur --help avec une commande. Par exemple, gh ado2gh --help liste toutes les commandes disponibles et gh ado2gh migrate-repo --help liste toutes les options disponibles pour la commande migrate-repo.
Step 2: Set environment variables
Before you can use the ADO2GH extension to migrate to GitHub Enterprise Cloud, you must create personal access tokens that can access the source and destination organizations, then set the personal access tokens as environment variables.
-
Make sure you have your personal access tokens for both GitHub and Azure DevOps ready. See Manage access if you haven't already created a token.
-
Set environment variables for the personal access tokens, replacing TOKEN in the commands below with the personal access tokens you previously created. Use
GH_PATfor the destination organization andADO_PATfor the source organization.-
If you're using Terminal, use the
exportcommand.Shell export GH_PAT="TOKEN" export ADO_PAT="TOKEN"
export GH_PAT="TOKEN" export ADO_PAT="TOKEN" -
If you're using PowerShell, use the
$envcommand.Shell $env:GH_PAT="TOKEN" $env:ADO_PAT="TOKEN"
$env:GH_PAT="TOKEN" $env:ADO_PAT="TOKEN"
-
-
Si vous effectuez une migration vers GitHub Enterprise Cloud avec résidence des données, par commodité, définissez une variable d’environnement pour l’URL de l’API de base pour votre entreprise.
Vérifiez que vous remplacez
SUBDOMAINpar le sous-domaine de votre entreprise. Par exemple, si le sous-domaine de votre entreprise estacme, laTARGET_API_URLvaleur esthttps://api.acme.ghe.com.-
Si vous utilisez le Terminal, utilisez la commande
export.Shell export TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
export TARGET_API_URL="https://api.SUBDOMAIN.ghe.com" -
Si vous utilisez PowerShell, utilisez la commande
$env.Shell $env:TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
$env:TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
Vous allez utiliser cette variable avec l’option
--target-api-urldans les commandes que vous exécutez avec le GitHub CLI. -