SourceHut pages quick start
The steps for publishing your capsule are:
- Generate a personal access token
- Create a tarball with your capsule's contents
- Upload your tarball to pages.sr.ht
Once you’re live, we’ll look at ways to automate the process.
Your personal access token
You can generate your personal access token via meta.sr.ht:
OAuth 2.0 personal access tokens
Write it down for later reference.
Building your tarball
Here's a simple example. Let's say you write this file to index.gmi:
# My sourcehut capsule
Welcome to my cool sourcehut capsule!
You can create a tarball for it like so:
$ tar -cvz index.gmi > site.tar.gz
Add any number of files other than index.gmi to expand this.
Using a static capsule generator
Here's another example of a capsule using gssg:
$ gssg
$ tar -C public -cvz . > site.tar.gz
gssg
You can use any tool, just so long as it outputs static content.
Uploading your tarball
Once you have a tarball, upload it to pages.sr.ht:
$ curl --oauth2-bearer "access token" \
-Fcontent=@site.tar.gz \
-Fprotocol=GEMINI \
https://pages.sr.ht/publish/username.srht.site
Substitute “access token” with your personal access token, and username with your sr.ht username.
Want to use your own domain name? Review the extra steps here.
Once you run this command, your capsule should now be live at gemini://username.srht.site!
Next: Automating deployments
Automating deployments