GithubMigrate can be used to migrate from Github Enterprise to Github Cloud or between organizations within the same github instance, or between two github enterprise instances when access to the Github migration tool is not available.
Note: This step will go away in a future release
To install the required python modules execute the following command from inside the GithubMigrate directory.
pip install -f .\requirements.txt
This migration tool migrates repositories using personal access tokens from a source GitHub instance to another. In this case from the self hosted GE instance of GitHub (source) to the normal Microsoft hosted GitHub (target).
There are 3 steps:
You will need to generate access tokens for both the GE GitHub and normal Github. Repeat the process below for each system.
If needed, confirm you password.
BH Migration
.
This is just a description to identify the token usage.
Warning: If something is not checked, the migration will be partial.
Note: This token will only be used by yourself and the tool.
If lost, just delete this token and generate a new one.
If creating the token for Normal GitHub, continue with MFA authorization. GE GitHub does not need this.
Run the below command to generate a list of repo's for a given organization in the source GitHub instance. This will generate the file .\repofile.txt
python .\main.py --sourcepat <Source Personal Access Token> --sourceuser <Source Username> --sourceorg <Source Org> --targetpat <Target Personal Access Token> --targetuser <Target Username> --targetorg <Target Organization Name> --generaterepofile
Example: python .\main.py --sourcepat a5453d243b2e6fd9fc3fasdfawerf879aa --sourceuser 501649102 --sourceorg FooOrg --targetpat ghp_FAV4R33zocb3RkRJOLXzasdfNasdfdxrf --targetuser oscarthegrouch --targetorg BarOrg --generaterepofile
.\repofile.txt
and remove any repositories you do not want migrated. Given the generated list, content is copied from the source GitHub instance to the target instance. This includes: repository, branches, pull requests, and issues. It does not include: repository settings or the wiki
repofile.txt
file has been created.Run the below command to start migration. Status updates will be returned via the console window.
python .\main.py --sourcepat <Source Personal Access Token> --sourceuser <Source Username> --sourceorg <Source Org> --targetpat <Target Personal Access Token> --targetuser <Target Username> --targetorg <Target Organization Name> --migrate
Example: python .\main.py --sourcepat a5453d243b2e6fd9fc3fasdfawerf879aa --sourceuser 501649102 --sourceorg FooOrg --targetpat ghp_FAV4R33zocb3RkRJOLXzasdfNasdfdxrf --targetuser oscarthegrouch --targetorg BarOrg --migrate
Tip: Run in smaller batches so manual verification can be performed by splitting your repofile into smaller chunks and specifying with the --file command for each file.
python .\main.py --sourcepat <Source Personal Access Token> --sourceuser <Source Username> --sourceorg <Source Org> --targetpat <Target Personal Access Token> --targetuser <Target Username> --targetorg <Target Organization Name> --file <path to repo file> --migrate
Example: python .\main.py --sourcepat a5453d243b2e6fd9fc3fasdfawerf879aa --sourceuser 501649102 --sourceorg FooOrg --targetpat ghp_FAV4R33zocb3RkRJOLXzasdfNasdfdxrf --targetuser oscarthegrouch --targetorg BarOrg --file repofile1.txt --migrate