Moving a static site from GitHub to Codeberg Pages

Late to the party,1 I finally got around to experimentally moving a GitHub Pages-hosted static site to Codeberg. I wanted a low-risk site to try first, so I moved Beige Buttons, the site hosting my “90s PC turbo button simulator” web component.

Ê

Mostly for my own benefit later, here’s the steps I took and the things I learned along the way:

  1. You can migrate a repository across in about two clicks. Easy!
  2. Codeberg Pages is deployed from the pages branch. If there’s no build step to the static site, all you need to do is rename the main branch to pages (and probably make it the default branch).2
  3. The default URL is https://username.codeberg.page/repository.
  4. You can use a custom domain by adding a .domains file that lists domains; if migrating from GitHub Pages you can just rename your CNAME file to .domains.
  5. You’ll need to tweak your DNS CNAME, ALIAS (or, worst-case, A/AAAA) record to point at Codeberg Pages.3

Change propogation feels slightly slower than GitHub, but perfectly tolerable.

The one thing that’s causing me trouble is that Codeberg Pages’ CORS headers prevent people from hotlinking the Beige Buttons JS, so there are some projects for which this wouldn’t be a suitable migration (issues are raised). But for most static sites, it’d probably Just Work and seems to be a great alternative.

Footnotes

1 With thanks to Kev for reminding me I’d had this on my list.

2 There are other ways to deploy but they don’t support custom domains yet.

3 Like GitHub Pages, Codeberg Pages uses LetsEncrypt for certificate provision, so you don’t need to change any CAA records.

2 comments

  1. Spencer Spencer says:

    Kev lists four reasons for migrating.

    1. Microsoft ownership
    2. Microsoft training Copilot on open source software
    3. Large amounts of downtime
    4. Reliance on big tech

    What are your motivations? Why codeberg and not self-housing?

    1. Dan Q Dan Q says:

      Mostly 3 & 4; I’m trying to reduce my centralisation in general. But also, Microsoft’s recent behaviour especially regarding AI has been… suboptimal.

      I chose Codeberg because I’d long wanted to experiment with it. I’m not committed to it yet! But as to why I’ve used GitHub/Codeberg Pages at all rather than self-hosting: many of my static sites go many years without maintenance, and I’ve on a couple of occasions failed to migrate one along with other sites hosted on the same system, or otherwise accidentally broken them as a result of architectural changes. My aim with using GitHub Pages was always to come up with a simple, reliable system that’s tightly-bound to my source control.

      I’m considering selfhosting something like Forgejo or Gitea with a “pages” plugin to achieve the same kind of thing. Or to build a simple static hosting system that “pulls” from repos, perhaps on a webhook call. I haven’t decided yet!

Reply here

Your email address will not be published. Required fields are marked *

Reply on your own site

Reply elsewhere

You can reply to this post on Mastodon (@blog@danq.me).

Reply by email

I'd love to hear what you think. Send an email to b29055@danq.me; be sure to let me know if you're happy for your comment to appear on the Web!