sr.ht, or sourcehut is “is a collection of tools useful for software development”, including git repository hosting.
I had to make a change to the library, and this was my first time contributing to a sr.ht repository. The workflow was quite different from what I am used to and required quite some Googling before I came up with something that I was happy with. So here goes my workflow.
Firstly, if you haven’t used sr.ht before you’ll need to create an account and set up some way of pushing code (SSH keys etc). There are some fairly good docs for this already for Setting up your account and first git repository, but you can stop at Creating a git repository.
Once you have an account set up you need to find the sr.ht repository that you want to work with. In my case that is at the URL https://git.sr.ht/~taavi/laravel-socialite-mediawiki
You can find a clone URL over on the right-hand side of the repo page, and you want to go ahead and clone the repo.
Code language: PHP (php)
git clone https://git.sr.ht/~taavi/laravel-socialite-mediawiki
You then also want to fork the repo into your own sr.ht account. The button is also on the right.
(You can also use your local clone to send a git email, but I didn’t want to install this tooling)
You can now also navigate to your fork, in my case https://git.sr.ht/~addshore/laravel-socialite-mediawiki and add this remote to your existing local repo. I’m going to call my remote
git remote add addshore firstname.lastname@example.org:~addshore/laravel-socialite-mediawiki
You can now make your change locally in a branch, and push it to your fork of the repository.
Code language: PHP (php)
# Checkout a new branch for your changes git checkout -b my-new-branch # Change your files and add them to a git commit git commit # Push then to your fork git push addshore my-new-branch
When browsing your fork you’ll find a button prompting you to “Prepare a patchset”. Click this!
You should be able to see the branch that you just pushed, and then selecting the branch you’ll also be able to see the commit that you just made. If this all looks good you can click the “Continue” button at the bottom.
Next, you’ll be prompted for some more information. The patchset revision should be 1 to start with, and if you want to amend in the future and send new patches this can be incremented. You can also write a cover letter describing the patch that you are submitting.
Once done here you can hit the “Continue” button again.
Finally, you need to say who you are sending this patch to. For me this is detailed in the README of the repo that I want to contribute to, and is ~email@example.com
Enter the email, optionally CC yourself, and hit “Send patchset”
Your patchset should now be sent, and you can go and view this in the inbox that you sent it to.