My Git backup workflow on iOS (better than Working Copy)

This is the best workflow I found so far for Git backup and syncing on iOS. Best part is it’s completely free. It’s also more seamless than Working Copy once you manage to set it up correctly.

What we are going to achieve:

  • automatic commits on file change
  • semi-automatic push to Git on single button click from inside obsidian itself.

Firstly you have to follow the amazing guide on the below link to install and run a-shell commands

I preferred to setup git on desktop then copy .git folder to the mobile vault folder then git will be ready for a-shell lg2 commands.

Now comes the interesting part.

Install obsidian git plugin. It doesn’t work properly on mobiles for pulling and pushing, but works great for automatic commiting. So adjust commit settings according to your needs.

Now install the below iOS shortcut.
https://www.icloud.com/shortcuts/11b7988083014b34818371eb2e296fd8
Replace the ***** in the shortcut with your vault directly name on a-shell.

Install ‘Shortcut Launcher’ (SL) plugin. Create a new task to launch the previously installed sync Shortcut.

Install Commander plugin on obsidian if you don’t have it already. Use it to create a macro to run the previously created SL task. Add a button using Commander to run the macro.

Now we have this setup:

  • automatic git commits using obsidian git plugin.
  • an Obsidian button (I added it to tab bar or ribbon).
  • clicking the button → runs Commander macro → runs SL task → launches the iOS Shortcut → runs git commands on a-shell → returns back to Obsidian.
  • The whole thing takes a second to run.

I hope you enjoy.

6 Likes

If you want to put the button on the mobile toolbar, you can skip Commander and add it using the search box at the bottom of Settings > Mobile.

The Commander plugin is super cool, thanks for introducing it to me.

One question (stemming from my inexperience with version control best-practices): why use Obsidian Git for committing instead of just letting a-shell take care of it when the ribbon button is pressed? I notice that the shortcut runs lg2 add . and commit anyways, so why not stick with that and eliminate a plugin from the workflow?

You can use a-Shell alone. However the plugin adds the functionality of automating the committing so not to lose any edits incase you forgot to press the commander button.

1 Like

When I try to run the shortcut, I’m getting
Unable to open repository '%s' '.' [-3] - could not find repository from '.'

What am I doing wrong?
And for the shortcuts, do I replace *** with jump obsidian
Or should I go into the vault? I have no idea how to enter into the vault instead. Thank you for any help!

You are told that you are not in the folder where your git folder is.
Happened to me all the time when using the Shortcuts app.
I couldn’t find a reliable fix (was too lazy to try and reinstall in hopes of rewriting the preferences the app uses…then you’d need to also copy your ssh files beforehand, etc.).

Instead, I jailbroke the device and use alternative means.