Exporting the GitHub Enterprise Server source repositories
After locking the source repositories you can export them one at a time, or in bulk using a list of repository URLs in a text file. You will then create a single migration archive for the import process.
Note: Locking a repository prevents users from pushing to the repository or modifying a repository's resources, like issues, labels, milestones, wikis, and comments. New teams and collaborators can't be associated with a locked repository.
If you're performing a trial run, you don't need to lock repositories. Otherwise, it's highly recommended. For more information, see "About Migrations."
-
SSH into your GitHub Enterprise Server instance.
$ ssh -p 122 admin@HOSTNAME
-
To prepare a repository for export, use the
ghe-migrator add
command with the repository's URL:-
If you're locking the repository, append the command with
--lock
. If you're performing a trial run,--lock
is not needed.$ ghe-migrator add https://hostname/username/reponame --lock
-
You can exclude file attachments by appending
--exclude_attachments
to the command. File attachments can be large and may needlessly bloat your final migration archive. -
To prepare multiple repositories at once for export, create a text file listing each repository URL on a separate line, and run the
ghe-migrator add
command with the-i
flag and the path to your text file.$ ghe-migrator add -i PATH/TO/YOUR/REPOSITORY_URLS.txt
-
-
When prompted, enter your GitHub Enterprise Server username:
Enter username authorized for migration: admin
-
When prompted for a personal access token, enter the access token you created in "Preparing the GitHub Enterprise Server source instance":
Enter personal access token: **************
-
When
ghe-migrator add
has finished it will print the unique "Migration GUID" that it generated to identify this export as well as a list of the resources that were added to the export. You will use the Migration GUID that it generated in subsequentghe-migrator add
andghe-migrator export
steps to tellghe-migrator
to continue operating on the same export.> 101 models added to export > Migration GUID: example-migration-guid> Number of records in this migration: > users | 5 > organizations | 1 > repositories | 1 > teams | 3 > protected_branches | 1 > pull_request_reviews | 1 > milestones | 1 > issues | 3 > pull_requests | 5 > pull_request_review_comments | 4 > commit_comments | 2 > issue_comments | 10 > issue_events | 63 > releases | 3 > attachments | 4 > projects | 2
Each time you add a new repository with an existing Migration GUID it will update the existing export. If you run
ghe-migrator add
again without a Migration GUID it will start a new export and generate a new Migration GUID. Do not re-use the Migration GUID generated during an export when you start preparing your migration for import. -
If you locked the source repository, you can use the
ghe-migrator target_url
command to set a custom lock message on the repository page that links to the repository's new location. Pass the source repository URL, the target repository URL, and the Migration GUID from Step 5:$ ghe-migrator target_url https://hostname/username/reponame https://target_hostname/target_username/target_reponame -g MIGRATION_GUID
-
To add more repositories to the same export, use the
ghe-migrator add
command with the-g
flag. You'll pass in the new repository URL and the Migration GUID from Step 5:$ ghe-migrator add https://hostname/username/other_reponame -g MIGRATION_GUID --lock
-
When you've finished adding repositories, generate the migration archive using the
ghe-migrator export
command with the-g
flag and the Migration GUID from Step 5:$ ghe-migrator export -g MIGRATION_GUID> Archive saved to: /data/github/current/tmp/MIGRATION_GUID.tar.gz
- To specify where migration files should be staged append the command with
--staging-path=/full/staging/path
. Defaults to/data/user/tmp
.
- To specify where migration files should be staged append the command with
-
Close the connection to your GitHub Enterprise Server instance:
$ exit > logout > Connection to hostname closed.
-
Copy the migration archive to your computer using the
scp
command. The archive file will be named with the Migration GUID:$ scp -P 122 admin@hostname:/data/github/current/tmp/MIGRATION_GUID.tar.gz ~/Desktop
-
To import the archived migration data to a GitHub Enterprise Server instance, see "Importing migration data to GitHub Enterprise Server".