DEV Community

Cover image for First steps towards Codeberg
Thomas Künneth
Thomas Künneth

Posted on

First steps towards Codeberg

A lot of Europeans are currently talking about Europe having to become more independent from US-based big tech. Being a European myself, I feel the need for this, too. However, just talking won't make a difference. So, why not make this our New Year's resolution? Here's mine: I love open source. Given GitHub's recent trajectory toward centralisation, I feel there are better-suited homes for my repositories. That's why I will start migrating them to Codeberg.

What is Codeberg?

Codeberg is a community-driven non-profit platform for hosting software projects. Many consider it the leading independent alternative to commercial services like GitHub and Bitbucket. While it looks and feels very similar to GitHub, its underlying philosophy and legal structure are fundamentally different: unlike GitHub, which is owned by Microsoft, Codeberg is run by a German non-profit organisation called Codeberg e.V.. It is funded by donations rather than venture capital or ads. The platform runs on Forgejo, which is a community-governed fork of Gitea. Therefore, the very software used to run the site is itself open source and transparent. And it is privacy-focused. Since Codeberg is hosted in the European Union (Germany), it adheres to strict GDPR standards. It does not track users for advertising and avoids black box AI features like GitHub Copilot.

Does this sound appealing? To me it certainly did. That's why I decided to jump right in. In this introductory article, I'll show you my first baby steps, that is, registering and migrating the first GitHub repository.

Signing up

Registering is a very quick and pleasant experience. Visit https://codeberg.org, find and click the Register button.

Codeberg homepage

Just enter a username, your email address, a password, and the randomly generated number or word.

sign-up page

Once you click on Register Account, you should receive an email with the inevitable confirmation link.

Activation email

Click on the link to verify your email address. You will be directed to your personal Codeberg landing page.

Personal Codeberg landing page

Next, you may want to update some settings.

Settings page

While I won't walk you through the settings, I would like to encourage you to show your Codeberg account on Mastodon. First, add Mastodon to Codeberg. Look for the Website field or the Social Accounts section (if available in the current UI). Paste your full Mastodon profile URL (for example, https://mastodon.social/@tkuenneth) and click Update Profile at the bottom. Codeberg automatically adds the rel="me" attribute to the website link in your profile, which is exactly what Mastodon needs to verify you.

Next, open your Mastodon instance and visit your Profile page. Click Edit profile and find the Extra fields in Basic information. This is where you add labels and links. In the label column, type something like Codeberg. In the content column, paste your Codeberg profile URL (e.g., https://codeberg.org/tkuenneth).

Click Save Changes. It may take a short while until Mastodon detects that it's you, but in the end, it should look like this:

A Mastodon profile page with several verified links

Migrating your first repository

To start a migration, click on the + symbol on the top right, and select New migration.

Starting a migration from a drop down menu

The next step is to select the Git host you want to migrate from. The migration tool can migrate your repository data, as well as metadata like issues, labels, wiki, releases, and milestones.

Selecting the host

The most important piece of information is, of course, the url of the repository you want to migrate. To be able to also migrate metadata, you need to provide an access token.

Configuring the migration

Once you have specified the owner, the repository name, and the visibility, you can start the migration by clicking on Migrate repository. The following screenshot shows a freshly migrated repo.

Repository homepage

Finalising the migration

Once the new repository has been set up, you may want to update the README of the old repo by mentioning its new home and then archive the content (on GitHub, this makes it read-only).

I strongly advise against deleting the old repo. It’s tempting to want a clean break, but there are two big reasons to keep it:

  1. Broken Links: There are inevitably links to your code scattered across the web—in blog posts, old commits, or bookmarks—which you would render useless.

  2. Security (Namespace Hijacking): This is a risk many people overlook. If you delete a repository, that specific URL becomes available again. Someone else could potentially register that same name and host malicious code where your project used to be. By keeping your old repository as a placeholder or a tombstone, you ensure that you still control that space and can point your users safely to Codeberg.

So, the best move is to add a clear migration notice to the top of the README, set the repository to Archived, and let it serve as a signpost.

To learn more about migrations to Codeberg, read the official guide at https://docs.codeberg.org/advanced/migrating-repos/.

Top comments (11)

Collapse
 
goodevilgenius profile image
Dan Jones

As you mentioned, Codeberg is the flagship Forgejo instance, which is a Gitea fork.

But Forgejo is also incredibly easy to self-host. Anyone who writes code for a living should have no problem setting up an instance on their own machine and having total control over it.

My instance has been running for about a year, and I couldn't be happier that I decided to self-host.

Collapse
 
tkuenneth profile image
Thomas Künneth

Thanks for sharing your thoughts, Dan. You are absolutely right. I'd probably just want to add that, whether to self-host or rely on a pre-configured cloud-based offering, will be decided on quite a few aspects. Certainly, total control is an important driver. At least for me, convenience is, too 😅

Collapse
 
fyodorio profile image
Fyodor

Funny thing is I’m pretty sure this whole “it is an instance of Forgejo which is a fork of Gitea which is…” discourse sounds a bit confusing to newcomers 😅 While self-hosting something is quite straightforward for the target audience 😎

Collapse
 
richardpascoe profile image
Richard Pascoe • Edited

An excellent piece covering the underused Codeberg platform that is becoming more important to many of us that have privacy in mind and so wish to move away from Big Tech.

For myself, I am continuing to move towards fully Open Source solutions and platforms. I also hope to finally begin contributing to Open Source projects and I'm sure Codeberg will become central to that endeavour.

Collapse
 
sloan profile image
Sloan the DEV Moderator

We loved your post so we shared it on social.

Keep up the great work!

Collapse
 
contentin profile image
ContentIn

I like it. Awesome !!

Collapse
 
leob profile image
leob

I'm applauding this - it's not just a noble effort, but one that might increasingly gain urgency, the more our American 'friends' are no longer our friends ... stuff like this might start carrying geopolitical weight!

Collapse
 
farhandigital profile image
Farhan Digital

If you delete a repository, that specific URL becomes available again. Someone else could potentially register that same name and host malicious code where your project used to be

But a repo URL doesn't consist of the repo name alone, right? It also has your username in it. (github.com/username/reponame). So unless you deleted your Github account too, no one can hijack your repo URL.

Collapse
 
tkuenneth profile image
Thomas Künneth

Thanks for sharing your thoughts. You are certainly right. Both things probably won't happen at the same time. But who knows how things add up. So both might happen ... eventually. And then, the potential issue does arise. TL;DR I agree that the scenario is not particularly likely to happen, but it might

Collapse
 
mardeg profile image
Mardeg

Looking forward to a follow-up article with updated instructions on how to switch from Github to Codeberg as the source of a Cloudflare pages project. Mentioning this just because it's been ages since I initially set mine up and would need to learn the (new?) steps involved in the process again.

Collapse
 
marcello_h profile image
Marcelloh

Thanks, just transferred my projects.