Skip to content

Instantly share code, notes, and snippets.

@mwiesen
Last active November 3, 2016 13:30
Show Gist options
  • Save mwiesen/c0ee120c996f92a9cd6262175868d539 to your computer and use it in GitHub Desktop.
Save mwiesen/c0ee120c996f92a9cd6262175868d539 to your computer and use it in GitHub Desktop.

ghe-migrator export and import commands

Documentation: https://help.github.com/enterprise/admin/guides/migrations/
Blog post: https://github.com/blog/2171-migrate-your-repositories-using-ghe-migrator

Tested commands (have to run on virtual appliance)

# Exporting
export USERNAME=<user with permissions to export and import>
export GITHUB_TOKEN=<personal access token with repo and admin:org permissions>
# ... add all repositories to export
ghe-migrator add <repo url> -u $USERNAME -p $GITHUB_TOKEN
# ...
export EXPORT_UID=<displayed migration uid>
ghe-migrator export -g $EXPORT_UID -u $USERNAME -p $GITHUB_TOKEN
# Importing
export MIGRATION_ARCHIVE=<path to displayed migration archive>
ghe-migrator prepare $MIGRATION_ARCHIVE
export IMPORT_UID=<displayed migration uid>
# ... run as often as there are still conflicts to resolve
ghe-migrator conflicts -g $IMPORT_UID > conflicts.csv
ghe-migrator map -i conflicts.csv -g $IMPORT_UID
# ...
ghe-migrator import $MIGRATION_ARCHIVE -u $USERNAME -p $GITHUB_TOKEN -g $IMPORT_UID
ghe-migrator audit -g $IMPORT_UID
ghe-migrator unlock -g $IMPORT_UID -u $USERNAME -p $GITHUB_TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment