Migrating from GitHub to Codeberg
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Migrating from GitHub to Codeberg
I created my GitHub account back in May 2009, and like most developers much of my work since then has taken place on GitHub; both private and public work. In August 2015 I joined GitLab, and in the years followed I primarily used GitLab for my own work as well as for Inko. Part of this was because at the time GitHub was neglecting its product, and because I wanted to eat my own dog food so to speak.
我在 2009 年 5 月注册了 GitHub 账号,和大多数开发者一样,从那时起我的大部分工作(无论是私有还是公开项目)都在 GitHub 上进行。2015 年 8 月,我加入了 GitLab,并在随后的几年里主要使用 GitLab 来处理我自己的工作以及 Inko 项目。这部分是因为当时 GitHub 对其产品疏于管理,也因为我想“吃自己的狗粮”(即使用自己开发的产品)。
In 2023, I migrated Inko along with my personal projects back to GitHub. One of the goals was to make it easier to contribute to Inko and to increase awareness and popularity of it, as GitHub is where most people go to look for new projects; especially as the quality of search engines has degraded over the years. Another goal was that GitLab.com never took off as a popular alternative to GitHub in spite of it’s promise, something that I’m still frustrated about, especially considering the effort made towards this goal by myself and many of my (former) GitLab colleagues from that time.
2023 年,我将 Inko 和我的个人项目迁回了 GitHub。目标之一是让人们更容易为 Inko 做出贡献,并提高其知名度和受欢迎程度,因为 GitHub 是大多数人寻找新项目的地方,尤其是在搜索引擎质量逐年下降的情况下。另一个目标是,尽管 GitLab.com 曾被寄予厚望,但它从未成为 GitHub 的主流替代品,对此我至今仍感到沮丧,尤其是考虑到我和许多(前)GitLab 同事当时为此付出的努力。
While moving back to GitHub did somewhat increase the amount of contributors to Inko, measuring the impact on visibility is a lot more difficult. Sure, the number of stars of the project has increased but that’s ultimately a measurement of how many people use GitHub and not so much how many actually like the project and want to use it. For example, I myself at times star projects as a way of just bookmarking them so I can look into them deeper into the future; not so much because I think to myself “Damn, this is cool and I want to use this”.
虽然迁回 GitHub 确实在一定程度上增加了 Inko 的贡献者数量,但衡量其对可见度的影响要困难得多。诚然,项目的星标数量增加了,但这归根结底衡量的是有多少人在使用 GitHub,而不是有多少人真正喜欢并想使用该项目。例如,我自己有时也会给项目加星,仅仅是为了将其作为书签,以便将来深入研究,而不是因为我觉得“天哪,这太酷了,我想用它”。
What has been clear though is the increase in low-quality/wasteful interactions on GitHub. This has always been an issue on GitHub due to the relative low barrier to entry, but at least some amount of work was still required. Thanks to the ongoing digital opioid crisis rise of “AI”, this barrier dropped through the floor half way to China, for now one can “contribute” by just prompting a digital talking parrot high on cocaine Claude Code to submit pull requests containing thousands of lines of pure nonsense.
然而显而易见的是,GitHub 上低质量和浪费性的互动有所增加。由于进入门槛相对较低,这在 GitHub 上一直是个问题,但至少以前还需要付出一定的工作量。多亏了持续不断的“数字鸦片危机”——即“人工智能”的兴起,这个门槛已经降到了地平线以下,因为现在人们只需提示一个像嗑了药一样的数字鹦鹉(Claude Code),就能提交包含数千行纯粹废话的拉取请求(pull requests)。
While the slop “contributions” I’ve had to deal with personally have been small enough/simple enough to deal with so far, the writing is on the wall: GitHub is no longer the place where developers collaborate, but rather a place where “agents” projectile-vomit slop that serves no other purpose but to boost their owner’s ego.
虽然我个人目前处理的这些垃圾“贡献”还算小且简单,但大势已去:GitHub 不再是开发者协作的地方,而是一个“代理”喷射垃圾的地方,这些垃圾除了满足其所有者的虚荣心外,没有任何其他用途。
Ignoring this, there are also issues with Microsoft/GitHub in general not related to AI, that made me want something that feels more in the spirit of free software. Which brings me to Codeberg. Codeberg, for those living under a rock, is a centralized (and probably the most popular) instance of Forgejo, which is a fork of Gitea which in turn is a fork of Gogs.
抛开这些不谈,微软/GitHub 在 AI 之外也存在一些问题,这让我想要寻找一种更符合自由软件精神的东西。这就引出了 Codeberg。对于那些消息闭塞的人来说,Codeberg 是 Forgejo 的一个中心化(也可能是最受欢迎的)实例,而 Forgejo 是 Gitea 的一个分支,Gitea 本身又是 Gogs 的一个分支。
What I like about Codeberg in particular is it’s stance on hosting non-free software, its “no AI here” stance, and it’s organisational structure that should make enshittification less likely to happen. I’m not alone feeling drawn to Codeberg, with for example Zig moving from GitHub to Codeberg for similar reasons about a year ago.
我特别喜欢 Codeberg 的一点是它对托管非自由软件的态度、它“此处无 AI”的立场,以及它的组织结构,这应该能降低其走向平庸化(enshittification)的可能性。并非只有我一个人被 Codeberg 所吸引,例如 Zig 语言大约在一年前就出于类似的原因从 GitHub 迁移到了 Codeberg。
After thinking about moving to Codeberg for a while, I started the process of doing so a few weeks ago, starting with my personal repositories, followed by the repositories used for Inko. In total this meant going through 70+ repositories, though I did not migrate all them. For example, projects for which development ended years ago were not migrated.
在考虑了一段时间后,我几周前开始了迁移到 Codeberg 的过程,首先是我的个人仓库,随后是 Inko 使用的仓库。总共涉及 70 多个仓库,不过我并没有全部迁移。例如,那些多年前就已停止开发的项目就没有进行迁移。
“But Yorick this article is boring so far, I want the juicy details!” Yes yes, I know! Let’s get to it. Note that what follows below is a bit rough on the edges, as I have this recurring problem of thinking “I should write about this process as I do it”, then proceed to not do that, and then have to recall everything from memory when I do write down my findings later.
“但是 Yorick,这篇文章目前为止很无聊,我想要劲爆的细节!”是的,是的,我知道!让我们开始吧。请注意,以下内容可能有些粗糙,因为我有一个反复出现的问题:我总想着“我应该在操作过程中记录这个过程”,然后却没这么做,最后在写下心得时不得不凭记忆回忆一切。
Table of contents
目录
-
Migrating repositories
-
Replacing GitHub Actions with Forgejo Actions
-
Self-hosting Forgejo Actions runners
-
Building container images
-
Hosting private projects
-
Codeberg reliability and performance
-
Storage quotas
-
Conclusion
-
迁移仓库
-
用 Forgejo Actions 替换 GitHub Actions
-
自托管 Forgejo Actions 运行器
-
构建容器镜像
-
托管私有项目
-
Codeberg 的可靠性和性能
-
存储配额
-
结论
Migrating repositories
迁移仓库
The first step was to determine what I wanted to migrate. If you only have a few repositories then the process is pretty easy, but when migrating 70+ repositories the process becomes a bit more difficult. The approach I took was pretty simple: actively maintained or otherwise interesting projects (e.g. from a historical perspective or those worth showcasing) were migrated, others were archived on GitHub and left as-is.
第一步是确定我想要迁移的内容。如果你只有几个仓库,这个过程很容易,但当迁移 70 多个仓库时,过程就变得有些困难了。我采取的方法很简单:积极维护的或以其他方式有趣的项目(例如从历史角度看或值得展示的项目)被迁移,其他的则在 GitHub 上归档并保持原样。
Next, I created an issue on GitHub to track the progress and all the steps necessary (later moved to a Codeberg issue). Most notably, this issue contains a large list of TODOs to check off. TODOs are great, except for the part where GitHub at times resets the state of one item marked as done when you mark another item as done too quickly after the first one. Coding is apparently solved thanks to AI, but reliably updating a checkbox as “checked” is apparently still too difficult.
接下来,我在 GitHub 上创建了一个 issue 来跟踪进度和所有必要的步骤(后来移到了 Codeberg 的 issue 中)。最值得注意的是,这个 issue 包含了一个需要勾选的待办事项列表。待办事项很好,除了一个问题:当你太快地勾选另一个项目时,GitHub 有时会重置之前已标记为完成的项目状态。显然,编程问题已经通过 AI 解决了,但可靠地更新一个复选框为“已勾选”似乎仍然太难了。
To migrate the repositories, I used Codeberg’s (technically Forgejo’s) repository migration feature. While I likely could’ve automated this process, I ended up doing this by hand as I figured the time to properly automate it would likely exceed the time spent doing the work by hand, though in hindsight I think automating it probably would’ve been faster. The rest of the time is mainly spent waiting for the importer to do its work, followed by adjusting the relevant settings of each project (e.g. the available merge strategies for pull requests).
为了迁移仓库,我使用了 Codeberg(技术上是 Forgejo)的仓库迁移功能。虽然我本可以自动化这个过程,但我最终还是手动完成了,因为我觉得正确自动化所需的时间可能会超过手动完成的时间,尽管事后看来,自动化可能确实会更快。剩下的时间主要花在等待导入器完成工作,随后调整每个项目的相关设置(例如拉取请求的可用合并策略)。
One minor nuisance is that when the GitHub importer hits a GitHub rate limit it won’t notify you about this in any way, instead it just retains the last status (e.g. “Migrated 500 issues”) until the rate limit is reset at which point it will continue its work. The first time this happened I thought the importer got stuck, until about an hour later it resumed work and managed to import all remaining data without any further issues. Another minor nuisance is that the importer makes no attempt at l
一个小麻烦是,当 GitHub 导入器达到 GitHub 的速率限制时,它不会以任何方式通知你,而是保持最后的状态(例如“已迁移 500 个 issue”),直到速率限制重置,届时它才会继续工作。第一次发生这种情况时,我以为导入器卡住了,直到大约一小时后它恢复工作并成功导入了所有剩余数据,没有再出现其他问题。另一个小麻烦是,导入器没有尝试 l