Files
davideisinger.com/content/journal/migrating-from-github-to-sourcehut/index.md
David Eisinger 88dad39326 fix typo
2024-11-05 12:26:22 -05:00

4.1 KiB

title, date, draft, references
title date draft references
Migrating from GitHub to SourceHut 2024-11-05T12:21:55-05:00 false
title url date file
Switching to SourceHut Builds - Tim Hårek https://timharek.no/blog/switching-to-sourcehut-builds 2024-11-01T03:59:37Z timharek-no-becx2e.txt
title url date file
Cryptocurrency is an abject disaster https://drewdevault.com/2021/04/26/Cryptocurrency-is-a-disaster.html 2024-10-31T20:10:12Z drewdevault-com-yuxzdw.txt

I've moved this site's repository from GitHub to SourceHut, an alternative, open-source Git host. I thought I'd take a few minutes to explain the why and the how.

I've been on GitHub since 2008, and I still use it every day as part of my job. I've no major complaints -- I'm still worlds happier using it than when I'm forced to use Jira or similar. Still, something has shifted in the last 16 years.

I get regular emails from their salespeople trying to upsell us on more expensive enterprise plans; that's how it goes in a capitalist society, but I prefer my tech a little scrappier. I'm not crazy about Git -- open-source, decentralized technology -- becoming largely synonomous with a closed-source, centralized platform owned by a three-trillion dollar company, nor about my work and personal coding activity being all mixed up together. Furthermore, the way they've used open-source code to train up their LLM (Copilot) that they then sell back to developers doesn't sit right with me.

I learned about SourceHut from Tim Hårek and have been following along for a few years. A thread on Mastodon (alas, lost in the void) about Copilot finally motivated me to sign up. I happily paid $20 to support the effort as well as to get access to SourceHut Builds, their GitHub Actions equivalent (this post about why they require a paid account to use CI is a gem).

After a few evenings of tinkering, I've got this site (as well as my mdrenum tool) moved over. I'm pretty anti-bikeshedding at work, but this is my place to be exactly as fussy as my heart desires.

Setting up SourceHut Builds

Adding a new remote is as simple as

git remote rename origin github
git remote add origin git@git.sr.ht:~dce/davideisinger.com
git push origin main

But switching from GitHub Actions to SourceHut Builds took some doing. A few things to note:

  • & doesn't work for starting background tasks. Building this site requires starting a local image server and then calling it from Hugo. On GitHub, I could start the server with bundle exec ruby dither.rb &, but SourceHut seems to strip off the &, starting the process in the foreground and thus hanging the build. Switching over to rackup with the --daemonize option works fine.
  • Secrets go in files, not environment variables. If you need a secret as an environment variable, do something like this. Be sure to disable logging before you do this -- it's verbose in surprising ways (see "Keeping your secrets a secret" in the docs).
  • Add stuff to ~/.buildenv (which runs before every step) to reduce duplication. See docs and examples for this site and mdrenum.