To allow someone other than an organization owner to run a migration or download migration logs, you can grant the migrator role to a user or team.
To grant the migrator role using the CLI, you can use the GL2GH extension of the GitHub CLI.
-
Install the GitHub CLI.
- 有关 GitHub CLI 的安装说明,请参阅 GitHub CLI 存储库。
- If you already have GitHub CLI installed, run
gh --versionto ensure you're running version 2.4.0 or newer. If you have an older version, visit the GitHub CLI repository for upgrade instructions.
-
Install the GL2GH extension.
Shell gh extension install github/gh-gl2gh
gh extension install github/gh-gl2gh -
The GL2GH extension of the GitHub CLI is updated frequently. 为了确保使用的是最新版本,请更新扩展。
Shell gh extension upgrade github/gh-gl2gh
gh extension upgrade github/gh-gl2gh -
On GitHub, create and record a personal access token that has the
admin:orgscope. -
将 personal access token 设置为环境变量,将以下命令中的 TOKEN 替换为你在上面记录的 personal access token。
-
如果使用终端,请使用
export命令。Shell export GH_PAT="TOKEN"
export GH_PAT="TOKEN" -
如果使用 PowerShell,请使用
$env命令。Shell $env:GH_PAT="TOKEN"
$env:GH_PAT="TOKEN"
-
-
Use the
gh gl2gh grant-migrator-rolecommand, replacing ORGANIZATION with the organization you want to grant the migrator role for, ACTOR with the user or team name, and TYPE withUSERorTEAM.Shell gh gl2gh grant-migrator-role --github-org ORGANIZATION --actor ACTOR --actor-type TYPE
gh gl2gh grant-migrator-role --github-org ORGANIZATION --actor ACTOR --actor-type TYPE注意
如果你要授予 GHE.com 的迁移者角色,则你还必须包含企业子域的目标 API URL。 例如:
--target-api-url https://api.octocorp.ghe.com。