{"id":15763297,"url":"https://github.com/trilom/github-migrator","last_synced_at":"2026-05-01T15:32:31.739Z","repository":{"id":143815789,"uuid":"562609909","full_name":"trilom/github-migrator","owner":"trilom","description":"Export github info and import to github-enterprise-server","archived":false,"fork":false,"pushed_at":"2022-11-06T21:24:29.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-05T11:41:31.189Z","etag":null,"topics":["github","github-enterprise-cloud","github-enterprise-server"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trilom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-06T21:24:07.000Z","updated_at":"2022-11-07T18:57:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"d0032acf-1208-4fe8-bde9-6b048b022ff6","html_url":"https://github.com/trilom/github-migrator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/trilom/github-migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trilom%2Fgithub-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trilom%2Fgithub-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trilom%2Fgithub-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trilom%2Fgithub-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trilom","download_url":"https://codeload.github.com/trilom/github-migrator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trilom%2Fgithub-migrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32503102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","github-enterprise-cloud","github-enterprise-server"],"created_at":"2024-10-04T11:41:28.749Z","updated_at":"2026-05-01T15:32:31.720Z","avatar_url":"https://github.com/trilom.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# github-migrator\n\n```bash\n# create a buildx builder\ndocker buildx create --use --name builder --driver docker-container --buildkitd-flags '--allow-insecure-entitlement security.insecure'\n# create a ssh agent connection your builder can use\neval $(ssh-agent)\n# add the target github enterprise key to ssh/scp payload\nssh-add ~/.ssh/id_rsa\n\n# if you need to kill the builder\ndocker buildx builder rm\n```\n\n## export\n\n\u003e Just need to provide the source token (`SOURCE_TOKEN`) and organization(`ORGANIZATION`) as env vars.\n\n- Inputs:\n  - If the local **out** directory contains a file named _`ORGANIZATION`.tar.gz_ then this is moved inside the container _instead_ of pulling freshly from github cloud.\n- Outputs:\n  - Expect the `ORGANIZATION` to have been exported to _`ORGANIZATION`.tar.gz_ within the container.\n\n```bash\nSOURCE_TOKEN=ghp_tokenabc123 \\\nORGANIZATION=trailmix \\\n  docker buildx bake export\n```\n\n## import\n\n\u003e Just need to provide the target token (`TARGET_TOKEN`), target user (`TARGET_USER`), target hostname (`TARGET_HOSTNAME`) and organization(`ORGANIZATION`) as env vars.\n\n- Inputs:\n  - If the local **conflicts** directory contains a file named _`ORGANIZATION`-conflicts.csv_ then this is moved inside the container _instead_ of checking the mappings. [(This is useful if you tried to import and a failure occured and you need to manually edit the mappings.)](https://docs.github.com/en/enterprise-server@3.7/admin/user-management/migrating-data-to-and-from-your-enterprise/preparing-to-migrate-data-to-your-enterprise#adding-custom-mappings)\n- Deps:\n  - Run [export](#export).\n- Outputs:\n  - Expect the _`ORGANIZATION`.tar.gz_ to move to `TARGET_HOSTNAME` with the `SSH_AUTH_SOCK` provided over `TARGET_SSH_PORT` with `TARGET_SSH_USER`.\n\n```bash\nTARGET_TOKEN=ghp_ENTtokenabc123 \\\nTARGET_USER=trilom-trailmix \\\nTARGET_HOSTNAME=\"github.vms.mud.name\" \\\nORGANIZATION=trailmix \\\n  docker buildx bake import\n```\n\n## output\n\n\u003e Just need to provide the source token (`SOURCE_TOKEN`), target token (`TARGET_TOKEN`), target user (`TARGET_USER`), target hostname (`TARGET_HOSTNAME`) and organization(`ORGANIZATION`)\n\n- Deps:\n  - Run [export](#export) and [import](#import).\n- Outputs:\n  - Expect the local **out** directory to contain the _`ORGANIZATION`.tar.gz_ file and _`ORGANIZATION`-conflicts.csv_ file.\n- Exceptions:\n  - If there are conflicts and there was a failure, you can provide a file to override the derived conflicts file in the **conflicts/** directory as _`ORGANIZATION`-conflicts.csv_.\n\n```bash\nSOURCE_TOKEN=ghp_tokenabc123 \\\nTARGET_HOSTNAME=\"github.vms.mud.name\" \\\nTARGET_USER=trilom-trailmix \\\nTARGET_TOKEN=ghp_ENTtokenabc123 \\\nORGANIZATION=trailmix \\\n  docker buildx bake\n```\n\n### cleanups\n\n```bash\n## list all repos in all migrations for an org\ncurl -H \"Authorization: Bearer ghp_tokenabc123\" -H \"Accept: application/vnd.github+json\" https://api.github.com/orgs/trailmix/migrations | jq -e '[.[].repositories[].name]' \u003e repo-names.json\ncurl -H \"Authorization: Bearer ghp_tokenabc123\" -H \"Accept: application/vnd.github+json\" https://api.github.com/orgs/trailmix/migrations | jq -e '[.[].id]' \u003e ids.json\n\n# after two files exist, make a bunch of commands to unlock\necho 'jsonencode([for k,v in setproduct(jsondecode(file(\"ids.json\")),jsondecode(file(\"repo-names.json\"))): format(\"curl -H \\\"Authorization: Bearer ghp_tokenabc123\\\" -X DELETE -H \\\"Accept: application/vnd.github+json\\\" https://api.github.com/orgs/trailmix/migrations/%s/repos/%s/lock\",v[0],v[1])])' | packer console -config-type=hcl2 | jq -r -e '.[]'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrilom%2Fgithub-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrilom%2Fgithub-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrilom%2Fgithub-migrator/lists"}