GitHub to Codeberg Migration - Part 1 - Repositories

In this blog post, I'd like to describe my experience with the migration of repositories from GitHub to Codeberg. The migration is still in progress, so I will update this blog post, when I will have a new lesson learned.

Starting Point

As I described in my previous post, I have three use cases for using GitHub:

  1. Hosting the source code of my blog and homepage and deploying them to Netlify.
  2. Hosting source code of some pet projects or sample projects.
  3. Having forks from open-source projects where I'm contributing.

For the third use case, I have decided to stay on GitHub to keep my contribution workflow simple. For the first use case, I have decided to migrate them completely and delete the repositories on GitHub. Also, I want to have a solution for hosting the website. Therefore, I choose Codeberg Pages as the solution. How I configure it, I will describe it in a separate blog post (still wip).

For the second use case, I have to decide repository by repository what to do (still wip). But I have indicated three kinds of repositories:

  1. New repositories
  2. Read-only repositories
  3. Still active repositories

The easiest case is starting new projects, I will do it directly on Codeberg.

Some repositories are archived (read-only). I will leave them on GitHub. I doubt that it has a benefit to invest time in migrating them to Codeberg (currently).

For still active repositories, I have no decision, only ideas. One idea is to migrate them to Codeberg and create a mirror on GitHub to the new repository on Codeberg. I already found a tutorial for that, but I still don't try it out. The reason is for a mirror is, that I have already shared links to these repositories. Some repositories have also gotten some contributions. I don't want to force contributors to use Codeberg (currently :)). But I'm sure I will update this blog post in the future when I find a solution for this kind of repositories.

But firstly, I want to concentrate me on the repositories of my blog and homepage, so the next step is migrate a whole repository and delete it on GitHub.

Repository Migration From GitHub - My Experience

Codeberg has an excellent step-by-step instruction for the migration from GitHub to itself.

The game changer here is that Codeberg (or Forgejo) has a built-in mechanism for the migration that also migrates the metadata of your repository. Of course, you could migrate the repository with Git on-board tools, but then you will lose metadata like issues, pull requests/merge requests, releases, wiki, labels and milestones.

The steps in short:

  1. In GitHub, create an access token for your repository that should be migrated.
  2. In Codeberg, select New migration when you click on the + symbol on the top right.
  3. Select your host, in my case GitHub
  4. Fill out the form (which repository should be migrated, add the access token, choose the meta data that should also be migrated).
  5. Start the migration and wait.
  6. After a successful migration, delete the repository on GitHub.

In my case, it works like a charm and, because my repositories are not so huge, it was very fast.

After I have migrated the source code, the next step is to set up the Codeberg Pages for these repositories.