On this pageDecide what moves, and what can stay
Teams leave GitHub for different reasons: the cost of seats and CI minutes, where their code and data live, how hosted code may be used, outages that stop a release, or a plain preference for running their own tools. Whatever the reason, Git history is the easy part. git was built to be copied. The work is in everything around the history: issues, CI, secrets, packages, links in other people's code, and the habits of everyone on the team.
This guide moves repositories in stages, so that each step can be undone and nobody loses a day of work.
Decide what moves, and what can stay
Not every asset travels the same way. List them per repository before you pick a date:
| Asset | How it moves | Notes |
|---|---|---|
| Branches and tags | Always, with plain Git | Complete and exact |
| Git LFS objects | Explicit fetch and push | Easy to forget until a checkout fails |
| Issues, pull requests, labels, milestones, releases, wiki | Importer in the new forge | Best effort: original authors appear by name, not as working accounts |
| Actions workflows | Ported by hand | Similar YAML elsewhere, but not identical |
| Secrets | Re-created from your own records | GitHub never reveals stored secret values |
| Packages and container images | Copied with registry tools | Old references keep pointing at GitHub |
| Webhooks, apps, branch protection | Re-created | Use the move to drop what nobody uses |
| Stars, forks, watchers | Do not move | The cost of leaving a network |
A partial move is a legitimate result. Many teams move private repositories to a server they run and keep public open-source projects on GitHub, or keep a read-only mirror there so that people can still find them.
Pick the destination
For a self-hosted forge, Forgejo and Gitea are light enough for a small server and include issues, pull requests, packages and Actions-style CI. GitLab Community Edition brings a complete platform but needs at least 8 GB of memory. Open-source projects that want a hosted, non-profit home often choose Codeberg, which runs Forgejo. On CloudSat, Forgejo, Gitea and GitLab deploy as one-click apps on a server you control.
Set up organizations and team accounts on the new forge before importing anything: an import needs its target owner to exist, and every contributor needs a login of their own, since imported comments carry the original author's name but cannot sign that person in.
Stage 1: mirror the code
Start with a copy that changes nothing for developers. Forgejo and Gitea can create a pull mirror from GitHub that refreshes on a schedule: choose New migration, then GitHub, and tick the mirror option. A mirror carries the repository's Git data, not its issues or pull requests, which is exactly what this stage needs.
To copy by hand, or into a forge without a mirror feature:
git clone --mirror https://github.com/acme/shop.git
cd shop.git
git lfs fetch --all # only for repositories that use LFS
git push https://git.example.com/acme/shop.git 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
git lfs push --all https://git.example.com/acme/shop.git
The explicit refspecs matter. A mirror clone from GitHub also contains read-only refs/pull/* references for every pull request, and many servers reject them, which makes a plain git push --mirror end in errors.
Stage 2: run CI on the new side
While GitHub is still the source of truth, make builds pass on the new forge. Forgejo and Gitea Actions read GitHub-style workflow YAML and run many existing actions, but expect edits: runner labels in runs-on, contexts specific to GitHub, and actions that call GitHub's API, such as those creating releases or commenting on pull requests. GitLab needs a rewrite into .gitlab-ci.yml.
Register runners on your own servers, recreate secrets from your password manager or secrets store, and run both pipelines side by side for a week. Matching results on real commits are the best evidence that the move is ready.
Stage 3: cutover day
- Freeze GitHub. Announce a time, merge or close open pull requests, and stop pushes.
- Run the full import. Delete the stage-1 mirror, then migrate again with an access token and issues, pull requests, labels, milestones, releases and the wiki selected. Import into the organizations and accounts you created earlier.
- Re-create the surroundings: branch protection, required reviews, team permissions, webhooks and deploy keys.
- Point every clone at the new remote:
git remote set-url origin git@git.example.com:acme/shop.git
git fetch origin
git branch -u origin/main main
- Mirror back, if you keep a public face. A push mirror on the new forge updates the GitHub repository after every push, so GitHub becomes a read-only copy instead of the place where work happens.
Stage 4: leave a pointer
GitHub does not redirect a repository to another host. Replace the README on GitHub with a short note and a link to the new location, update the repository description and website field, and archive the repository so it becomes read-only while staying visible. Archiving is reversible; deleting is not, and a deleted repository breaks every link and every pinned dependency at once.
Keep packages, imports and links working
The links you do not control are the ones that hurt later.
- Go modules encode the host in the module path, so moving
github.com/acme/shopbreaks every importer. A vanity path such asgo.acme.example/shop, served by a page with ago-importmeta tag, makes this move and any future one a configuration change. - Package manifests such as
package.json,pyproject.tomlandCargo.tomlcarry repository and homepage URLs. Update them in the next release. - Container images already deployed keep pulling from
ghcr.io. Copy the tags you still run to the new registry, then publish new tags only there:
skopeo copy --all docker://ghcr.io/acme/shop:1.8.0 docker://git.example.com/acme/shop:1.8.0
- Badges, docs and wikis often link to GitHub URLs for issues and pipelines. Search your repositories for
github.com/acmeand fix them in one pass.
FAQ
What happens to contributors who only use GitHub?
Keep the GitHub repository as a push mirror with a clear pointer, and say in the contribution guide where issues and changes are accepted now. Some people will follow; others will send fewer contributions. For a popular open-source project, that trade deserves a decision of its own before you move.
Do issue numbers and links survive the import?
Mostly. Forgejo, Gitea and GitLab importers recreate issues and pull requests with their comments and usually keep their numbers, so #123 in a commit message still means the same issue. Full links to github.com URLs, in commits, docs and other people's projects, keep pointing at GitHub. Spot-check a few busy repositories before you announce the move as finished.
Can we move back if it goes wrong?
Yes, until you delete the GitHub side. That is why the plan archives instead of deleting, and keeps GitHub as a mirror for as long as you are unsure. Git history can always be pushed back; only the work done in issues after the move would need copying by hand.
How long should the whole move take?
Plan by stages, not by hours: a stage-1 mirror takes minutes per repository, while porting CI and integrations takes as long as your pipelines are complex. Freeze GitHub only after stage 2 has shown green builds on real work.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




