Skip to main content

% 16k.es

iPad stuff: syncing with git

The iPad, particularly the iPad Mini, is such a versatile tool. It allows you to leave your laptop at home while still handling light tasks that would typically require a computer.

iSH

I recently got a new iPad Mini. My wife was looking for an upgrade, so I struck a deal: she could have my relatively new iPad Pro (or was it? Now I’m second-guessing!) if she got me the iPad Mini in return. Win-win! 😁

The iPad Mini is enought for me, and I love the form factor, it even fits in my back pocket! It goes without saying that it easily fits in my smallest backpack.

A couple of weeks ago, I attended a training session and initially carried a laptop in my backpack. However, after a few days, I decided to try relying solely on my iPad. While I’m not a big fan of the on-screen keyboard for anything beyond a quick search, I paired it with a compact Bluetooth keyboard—and it worked out pretty well!

I usually take notes using Markdown, and thankfully, there are plenty of options to choose from like Obsidian, Logseq, and others. Both Obsidian and Logseq are available for iPad, so far so good.

But I like to keep my notes synchronized across different devices and things may get a bit tricky.

There are plenty of options for syncing notes, but my favorite is Git. However, due to the limitations of iPadOS, using Git isn’t always straightforward. Apps like Working Copy can simplify the process, but it comes with a catch—it’s not free. While I wouldn’t mind paying for it upfront, I’m increasingly weary of subscription-based models.

# iSH to the rescue

iSH is a project to get a Linux shell environment running locally on your iOS device, using a usermode x86 emulator. It’s a great tool that I use a lot! It certainly alleviates the need to carry my laptop everywhere I go while I am still able to do some work and connect to my servers.

What I didn’t know until recently is it can mount other file providers directory. And this is all we need to use git!

Let’s see an example with Obsidian (with Logseq it would be exactly the same)

First of all we need to install a couple of packages in iSH:

localhost:~# apk update
localhost:~# apk add git openssh-client

Feel free to add more packages, maybe neofetch for a nice screenshot:

ish screenshot

Chances are that your git repo is to be accessed via ssh, so add your key pair here. I won’t go into the details, it’s just adding your keys as usual.

Also create your /root/.ssh/config file:

Host github.com
	User git
	Hostname github.com
	PreferredAuthentications publickey
	IdentityFile /root/.ssh/id_github

Before continue, ensure obsidian is already installed and open it. Create a new vault, I have called mine notes in a display of inventiveness. Do not store it in iCloud.

Now we are going to make a directory in our ish environment to mount the local obsidian vault:

cd ~
mkdir obsidian
mount -t ios . obsidian

A file picker will show up, choose your recently create folder:

File picker

We’re almost there. cd to your recently created ~/obsidian directory. You’ll notice an .obsidian directoy inside we do not want. Remove it and clone your real repo:

cd ~/obsidian
rm -rf .obsidian/
git clone git@github.com:user/reponame.git .

Don’t forget the dot at the end! We want the repo to be cloned in our ~/obsidian directory of choice.

Now go back to obsidian (you may have to restart it though) and… voilà! Your favourite repo is there.

Of course this will not automagically sync things without manual intervention, you still have to go through the usual git workflow. But it should not be a problem if you’re familiar with the git workflow, right?

A note of warning: this may be slow. Do not forget it is running in an emulation so do not expect bare metal performance.

Enjoy your iPad!