Frecuentemente publicamos actualizaciones de nuestra documentación. Es posible que la traducción de esta página esté en curso. Para conocer la información más actual, visita la documentación en inglés. Si existe un problema con las traducciones en esta página, por favor infórmanos.
Versión del artículo: Enterprise Server 2.21

Exporting migration data from GitHub.com

You can export migration data from an organization on GitHub.com by using the API to select repositories to migrate, then generating a migration archive that you can import into a GitHub Enterprise Server instance.

En este artículo

Preparing the source organization on GitHub

  1. Ensure that you have owner permissions on the source organization's repositories.

  2. Genera un acceso de token con los alcances repo y admin:org on GitHub.com.

  3. Para minimizar los tiempos de inactividad, haz una lista de repositorios que deseas exportar desde la instancia de origen. Puedes agregar múltiples repositorios a una exportación a la vez usando un archivo de texto que muestra la URL de cada repositorio en una línea separada.

Exporting the organization's repositories

Nota: Las relaciones de las bifurcaciones no persisten después de una migración.

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. To access the Migrations API, you must provide a custom media type in the Accept header: application/vnd.github.wyandotte-preview+json. The examples below include the custom media type.

Generating a migration archive

Nota:Cerrar un repositorio previene que los usuarios suban información al mismo o que modifiquen sus recursos como informes de problemas, etiquetas, hitos, wikis, y comentarios. Los nuevos equipos y colaboradores no podrán asociarse con un repositorio cerrado.

Si estás realizando una ejecución de prueba, no necesitas cerrar el repositorio. En el resto de los casos, se recomienda ampliamente. Para obtener más información, consulta "Acerca de las migraciones".

  1. 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."

  2. Start a migration by POSTing 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.wyandotte-preview+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 to true. This is highly recommended.
    • You can exclude file attachments by passing exclude_attachments: true to the endpoint. Los archivos adjuntos pueden resultar muy grandes y es posible que sobrecarguen tu archivo de migración final de manera innecesaria. 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.

  3. 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.wyandotte-preview+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.
  4. 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 "Accept: application/vnd.github.wyandotte-preview+json" \
      -u GITHUB_USERNAME:GITHUB_ACCESS_TOKEN \
      -L -o migration_archive.tar.gz \
      https://api.github.com/orgs/orgname/migrations/id/archive
  5. 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.wyandotte-preview+json" \
      https://api.github.com/orgs/orgname/migrations/id/archive
  6. Para importar los datos de migración archivados a una instancia de GitHub Enterprise Server , consulta "Importando datos de migración a GitHub Enterprise Server".

Pregunta a una persona

¿No puedes encontrar lo que estás buscando?

Contáctanos