This might get a bit technical, but I wanted to keep it here for myself. I’ve left out a few things a complete beginner would need, so this is more of a “note to myself”. But maybe it’s useful for the odd reader too.
I’ve been writing all my texts in Markdown for a few years now, before dumping them into a Word document at the very end and shipping them off to clients with a proper spell check.
About two years ago I started keeping my texts in a Git repository, pulling and pushing as I go. Meaning I work in loops. Instead of writing everything in real time, I decide when my clients get to see a new version. The big advantage: they don’t have to watch the open-heart surgery of the actual writing process.
These days I work on different machines in different places:
- on my iPad Pro, anywhere
- on my Windows PC, mostly in the office
- on my Raspberry Pi (my dedicated writing machine), usually from my garden shed. Very Thoreau-on-Walden-Pond, if Walden Pond had dodgy WiFi.
As you can see, that’s three different operating systems. And this is where Git shines: before I start, I pull the latest version from the server and get to work. In the terminal, that’s:
› git pull
Then I write in an existing document and when I’m done, I “commit” my changes. Basically telling Git “right, I’m happy with this version”. In the terminal:
› git commit -am “a comment about progress”
If I’ve been writing in a new Markdown document, I first need to tell Git to start tracking it:
› git add .
Once everything’s committed, I push it to the server with:
› git push
Using an SSH Key for Git
Sounds a bit odd, doesn’t it? To push changes to a repository — whether that’s Github, Bitbucket, or Gitea — you need to drop an SSH key with the service so you can get access.
First, create an SSH key:
› ssh-keygen
This creates a private and a public key. You can check them here:
› dir .ssh
Now go to Bitbucket and enter your SSH key. Typically you need to paste the contents of the public key. You can display it in the terminal like this:
› cat ~/.ssh/id_rsa.pub
When you update something via Git, you’ll need to enter your password. Gets old fast. If your machine is trusted, you can automate the password entry with these two commands:
› eval $(ssh-agent)
› ssh-add ~/.ssh/id_rsa
Now you can set up this workflow on all your devices.
The German original lives at reinergaertner.de, my blog since before most of the internet existed (1997). Translation: AI. Quality control: me, squinting. Apologies in advance.