Skip to main content
Мы публикуем частые обновления нашей документации, и перевод этой страницы может все еще выполняться. Актуальные сведения см. в документации на английском языке.

Granting the migrator role for GitHub Enterprise Importer

To allow someone who isn't an organization owner to run migrations, you can grant a person or team the migrator role.

Кто может использовать эту функцию

Organization owners can grant the migrator role.

About the migrator role

To remove the need for organization owners to complete migrations, GitHub.com includes a distinct role for using GitHub Enterprise Importer. Granting the migrator role allows you to designate other teams or individuals to handle your migrations.

You can grant the migrator role to an individual user or a team. We strongly recommend that you assign the migrator role to a team. Then, you can further customize who can run a migration by adjusting team membership. For more information about changing team membership, see "Добавление участников организации в команду" or "Удаление членов организации из команды."

You can only grant the migrator role for an organization on GitHub.com. If you're migrating a repository between two organizations on GitHub.com, you can grant the migrator role to the same person or team for both organizations, but you must grant each separately.

Note: You cannot grant the migrator role for enterprise accounts. Therefore, you can only run an organization migration if you're an owner of the destination enterprise. However, you can grant the migrator role to that enterprise owner for the source organization.

After you grant the migrator role, make sure the migrator uses a personal access token that meets all the requirements for running migrations. For the details of those requirements, see "Управление доступом для GitHub Enterprise Importer."

Чтобы просмотреть инструкции по использованию API, используйте переключатель инструментов в верхней части страницы.

Granting the migrator role with the ADO2GH extension

  1. В GitHub.com создайте и запишите personal access token, который соответствует всем требованиям для предоставления роли миграции. Полный список требований см. в разделе Управление доступом для GitHub Enterprise Importer.

  2. Задайте personal access token в качестве переменной среды, заменив TOKEN в приведенных ниже командах на personal access token, записанным ранее.

    • Если вы используете терминал, используйте export команду .
      Shell
      export GH_PAT="TOKEN"
    • Если вы используете PowerShell, используйте $env команду .
      Shell
      $env:GH_PAT="TOKEN"
  3. Use the gh ado2gh grant-migrator-role command, replacing ORGANIZATION with the organization you want to grant the migrator role for, ACTOR with the user or team name, and TYPE with USER or TEAM.

    Shell
    gh ado2gh grant-migrator-role --github-org ORGANIZATION --actor ACTOR --actor-type TYPE

Granting the migrator role with the BBS2GH extension

Примечание: Миграции с Bitbucket Server с помощью GitHub Enterprise Importer в настоящее время находятся в закрытой бета-версии и могут быть изменены. Сведения о том, как запросить доступ к бета-версии, см. в статье Присоединение к списку ожидания миграций bitbucket Server.

  1. В GitHub.com создайте и запишите personal access token, который соответствует всем требованиям для предоставления роли миграции. Полный список требований см. в разделе Управление доступом для GitHub Enterprise Importer.

  2. Задайте personal access token в качестве переменной среды, заменив TOKEN в приведенных ниже командах на personal access token, записанным ранее.

    • Если вы используете терминал, используйте export команду .
      Shell
      export GH_PAT="TOKEN"
    • Если вы используете PowerShell, используйте $env команду .
      Shell
      $env:GH_PAT="TOKEN"
  3. Use the gh bbs2gh grant-migrator-role command, replacing ORGANIZATION with the organization you want to grant the migrator role for, ACTOR with the user or team name, and TYPE with USER or TEAM.

    Shell
    gh bbs2gh grant-migrator-role --github-org ORGANIZATION --actor ACTOR --actor-type TYPE

Granting the migrator role with the GEI extension

Note: The GitHub CLI does not support granting the migrator role for organizations on GitHub Enterprise Server, so you must be an organization owner of the source organization to migrate repositories from GitHub Enterprise Server.

  1. В GitHub.com создайте и запишите personal access token, который соответствует всем требованиям для предоставления роли миграции. Полный список требований см. в разделе Управление доступом для GitHub Enterprise Importer.

  2. Задайте personal access token в качестве переменной среды, заменив TOKEN в приведенных ниже командах на personal access token, записанным ранее.

    • Если вы используете терминал, используйте export команду .
      Shell
      export GH_PAT="TOKEN"
    • Если вы используете PowerShell, используйте $env команду .
      Shell
      $env:GH_PAT="TOKEN"
  3. Use the gh gei grant-migrator-role command, replacing ORGANIZATION with the organization you want to grant the migrator role for, ACTOR with the user or team name, and TYPE with USER or TEAM.

    Shell
    gh gei grant-migrator-role --github-org ORGANIZATION --actor ACTOR --actor-type TYPE

Чтобы просмотреть инструкции по использованию GitHub CLI, используйте переключатель инструментов в верхней части страницы.

Granting the migrator role with the GraphQL API

You can use the grantMigratorRole GraphQL mutation to assign the migrator role and the revokeMigratorRole mutation to revoke the migrator role.

You must use a personal access token (PAT) that meets all access requirements. For more information, see "Управление доступом для GitHub Enterprise Importer."

grantMigratorRole mutation

This GraphQL mutation sets the migration role.

mutation grantMigratorRole (
  $organizationId: ID!,
  $actor: String!,
  $actor_type: ActorType!
) {
  grantMigratorRole( input: {
    organizationId: $organizationId,
    actor: $actor,
    actorType: $actor_type
  })
   { success }
}
Query variableDescription
organizationIdThe ownerId (or organization ID) for your organization, from the GetOrgInfo query.
actorThe team or username who you want to assign the migration role to.
actor_typeSpecify whether the migrator is a USER or TEAM.

revokeMigratorRole mutation

This mutation removes the migrator role.

mutation revokeMigratorRole (
  $organizationId: ID!,
  $actor: String!,
  $actor_type: ActorType!
) {
  revokeMigratorRole( input: {
    organizationId: $organizationId,
    actor: $actor,
    actorType: $actor_type
  })
   { success }
}