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.
-
安装 GitHub CLI。
- 有关 GitHub CLI 的安装说明,请参阅 GitHub CLI 存储库。
- 如果已安装 GitHub CLI ,请运行
gh --version以确保运行版本 2.4.0 或更高版本。 如果有较旧版本,请访问 GitHub CLI 存储库 以获取升级说明。
-
安装 ADO2GH extension。
Shell gh extension install github/gh-ado2gh
gh extension install github/gh-ado2gh -
ADO2GH extension of the GitHub CLI 每周更新一次。 为了确保使用的是最新版本,请更新扩展。
Shell gh extension upgrade github/gh-ado2gh
gh extension upgrade github/gh-ado2gh
每当需要有关 ADO2GH extension 的帮助时,都可以将 --help 标志与命令一起使用。 例如,gh ado2gh --help 会列出所有可用命令,gh ado2gh migrate-repo --help 会列出 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"
-
-
如果要迁移到 带有数据驻留权的 GitHub Enterprise Cloud,为方便起见,请为企业 的基本 API URL 设置环境变量。
确保将
SUBDOMAIN替换为您企业的子域。 例如,如果企业的子域为acme,则TARGET_API_URL值为https://api.acme.ghe.com。-
如果使用终端,请使用
export命令。Shell export TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
export TARGET_API_URL="https://api.SUBDOMAIN.ghe.com" -
如果使用 PowerShell,请使用
$env命令。Shell $env:TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
$env:TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
你将将此变量与在命令中运行
--target-api-url的选项一起使用GitHub CLI。 -