Preparing the source organization on GitHub
-
Ensure that you have owner permissions on the source organization's repositories.
-
repo
及びadmin:org
スコープでアクセストークンを生成してく� さい。 on GitHub.com. -
ダウンタイ� を最小化するには、ソースインスタンスからエクスポートしたいリポジトリのリストを作成してく� さい。 各行にそれぞれのリポジトリのURLをリストアップしたテキストファイルを使えば、複数のリポジトリをエクスポートに一度に追� できます。
Exporting the organization's repositories
ノート: フォークの関係は移行のあとまで存続しません。
To export repository data from GitHub.com, use the Migrations API.
The Migrations API is currently in a preview period, which means that the endpoints and parameters may change in the future.
Generating a migration archive
Note: Locking a repository prevents all write access to the repository. ロックされたリポジトリには、新しいTeamやコラボレータを関連づけることはできません。 トライアル実行をしているなら、リポジトリをロックする必要はありません。 使用中のリポジトリからデータを移行する� �合、
GitHubはそのリポジトリをロックすることを強くおすすめします。 詳細は「移行について」を参照してく� さい。
-
Notify members of your organization that you'll be performing a migration. The export can take several minutes, depending on the number of repositories being exported. The full migration including import may take several hours so we recommend doing a trial run in order to determine how long the full process will take. For more information, see "About Migrations."
-
Start a migration by sending a
POST
request to the migration endpoint. You'll need:- Your access token for authentication.
- A list of the repositories you want to migrate:
curl -H "Authorization: token GITHUB_ACCESS_TOKEN" \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ -d'{"lock_repositories":true,"repositories":["orgname/reponame", "orgname/reponame"]}' \ https://api.github.com/orgs/orgname/migrations
- If you want to lock the repositories before migrating them, make sure
lock_repositories
is set totrue
. This is highly recommended. - You can exclude file attachments by passing
exclude_attachments: true
to the endpoint. 添付ファイルは大きくなる� �合があり、最終的なマイグレーションアーカイブを不必要に膨らませてしまう� �合があります。 The final archive size must be less than 20 GB.
This request returns a unique
id
which represents your migration. You'll need it for subsequent calls to the Migrations API. -
Send a
GET
request to the migration status endpoint to fetch the status of a migration. You'll need:- Your access token for authentication.
- The unique
id
of the migration:curl -H "Authorization: token GITHUB_ACCESS_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/orgname/migrations/id
A migration can be in one of the following states:
pending
, which means the migration hasn't started yet.exporting
, which means the migration is in progress.exported
, which means the migration finished successfully.failed
, which means the migration failed.
-
After your migration has exported, download the migration archive by sending a
GET
request to the migration download endpoint. You'll need:- Your access token for authentication.
- The unique
id
of the migration:curl -H "Authorization: token GITHUB_ACCESS_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \ -L -o migration_archive.tar.gz \ https://api.github.com/orgs/orgname/migrations/id/archive
-
The migration archive is automatically deleted after seven days. If you would prefer to delete it sooner, you can send a
DELETE
request to the migration archive delete endpoint. You'll need:- Your access token for authentication.
- The unique
id
of the migration:curl -H "Authorization: token GITHUB_ACCESS_TOKEN" \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/orgname/migrations/id/archive
-
GitHub Enterprise Serverインスタンスへのアーカイブされた移行データのインポートの準備をするには、「Enterpriseへのデータ移行の準備」を参照してく� さい。