Skip to main content

Install and configure GitHub Enterprise Importer

Install the GL2GH extension of the GitHub CLI and configure your environment for the migration.

Run your migration

Статья 4 из 7
Следующий:Configure blob storage

В этой статье

Step 1: Install the GL2GH 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 GL2GH extension.

  1. Install the GitHub CLI.

    • Инструкции по установке для GitHub CLI см. в репозитории GitHub CLI.
    • If you already have GitHub CLI installed, run gh --version to ensure you're running version 2.4.0 or newer. If you have an older version, visit the GitHub CLI repository for upgrade instructions.
  2. Install the GL2GH extension.

    Shell
    gh extension install github/gh-gl2gh
    
  3. The GL2GH extension of the GitHub CLI is updated frequently. Чтобы убедиться, что вы используете последнюю версию, обновите расширение.

    Shell
    gh extension upgrade github/gh-gl2gh
    

Step 2: Set environment variables

Before you can use the GL2GH extension to migrate to GitHub Enterprise Cloud, you must create personal access tokens that can access the source and destination, then set the personal access tokens as environment variables.

  1. Make sure you have your personal access tokens for both GitHub and GitLab ready. See Manage access for a migration from GitLab to GitHub if you haven't already created a token.

  2. Set environment variables for the personal access tokens, replacing TOKEN in the commands below with the personal access tokens you previously created. Use GH_PAT for the destination organization and GITLAB_PAT for the source GitLab instance.

    • If you're using Terminal, use the export command.

      Shell
      export GH_PAT="TOKEN"
      export GITLAB_PAT="TOKEN"
      
    • If you're using PowerShell, use the $env command.

      Shell
      $env:GH_PAT="TOKEN"
      $env:GITLAB_PAT="TOKEN"
      
  3. Если вы переходите на GitHub Enterprise Cloud с размещением данных, для удобства, установите переменную среды для базового URL API для вашего предприятия.

    Убедитесь, что вы заменили SUBDOMAIN его на поддомен вашего предприятия. Например, если поддоменом вашего предприятия является acme, значением TARGET_API_URL будет .https://api.acme.ghe.com

    • Если вы используете терминал, используйте export команду.

      Shell
      export TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
      
    • Если вы используете PowerShell, используйте $env команду.

      Shell
      $env:TARGET_API_URL="https://api.SUBDOMAIN.ghe.com"
      

    Вы используете эту переменную с --target-api-url опцией в командах, которые выполняете с GitHub CLI.