[Mobile] Setting up iOS git-based syncing with mobile app (using Working Copy)

Here’s how I got my iPhone to sync with my existing vault that is stored on GitHub. Your mileage may vary, posting here in case it’s useful to others. I presume existing knowledge of Obsidian, GitHub, the Working Copy app, basic iOS, etc. Comments and feedback welcome!

  1. (Optional) If you don’t have an existing repository, or if you just want to test it out, create a new repository on GitHub. You don’t have to sync this with desktop Obsidian first (or ever) in order to sync it with the mobile app.

  2. Create a new vault in Obsidian mobile, deselecting “Store in iCloud”.

  1. (Optional, but recommended) Configure the Obsidian mobile app to use a different config folder (Settings → About → Advanced → Override config folder); e.g., .obsidian.mobile. If you don’t change this then, depending on what gets synced via git from your .obsidian configuration (such as your workspace), you might get some configuration that’s not supported on mobile (yet).

  1. In Working Copy, clone the git repository

  1. (Optional) Rename the local name of the git repository in Working Copy to the vault name you set up in Obsidian mobile (this is just so the correlation is obvious to you later)

  1. In the Working Copy repository “share sheet”…

… and select “Setup Folder Sync”.

  1. Select → On My iPhone/iPad → Obsidian → Vault Name

  1. Verify the syncing has started

You should now be able to manually pull, push, merge changes through [[Working Copy]]

44 Likes

This is great!

Does the plugin API expose hooks that would allow Obsidian for iOS to also call into Working Copy via its URL Schemes or Shortcuts support?

It would be great if Obsidian could tell Working Copy to periodically

  • pull, and/or
  • pull/commit/push
3 Likes

This is great thank you for sharing it.

This looks awesome. Out of curiosity, do you know if this approach works well with Git LFS?

(Background: I’m currently struggling with the best way to sync a vault that has grown larger than the 4GB permitted by Obsidian Sync. Right now I’m using external links + image thumbnails, but would rather keep everything together and was considering using a Git repo + LFS.)

I haven’t tried so can’t answer with any confidence. Perhaps a good question for the author of the obsidian-git plugin, who can be reached via GitHub - denolehov/obsidian-git: Backup your Obsidian.md vault with git?

This is great, thanks for sharing! Quick question (in case you also backup with Git on Desktop). Are you syncing mobile and desktop to the same repo? If so, have you ran into any issues?

Hey! For anothers app (I don’t have Obsidian Mobile yet :((), I try to do that. The problem is : I have a lot of error when syncing, and my phone start to burn.

The folder is just on the phone (not icloud). What the problem? :<

2 Likes

I just wanted to report back here with my LFS experiments.

I’m not using the Obsidian-git plugin, as I generally prefer to keep things a bit more manual, so I can’t speak to the LFS issue there. But as a manual flow using the Git command-line app, it works.

The biggest thing I’ve noticed for anyone interesting in using Obsidian + Working Copy + Git LFS to store and sync large vaults is that the Working Copy LFS support seems really touchy. Large numbers of new files, or even moves of existing files, seem to cause timeouts.

The LFS download process seems to keep running even when Working Copy takes an error, but sometimes the folder sync will kick off before this is finished and there will re-add files you’ve moved to their old location. So syncing lots of changes with files stored in LFS can mean multiple tries to get a good pull, and sometimes reverts to clean up after folder sync tries to be a little too smart.

That said, I ran into this during migration. I don’t move files like images, PDFs, and videos much, and day-to-day things work fine for me. But it’s certainly not a process I’d recommend for someone who doesn’t have a lot of patience or isn’t already comfortable with the basics of Git.

These are all Working Copy side problems though, so perhaps things will improve in the future.

Well, I think my problem is because of that (larger number of file + 1go of data). I need to try to add pdf and image in my gitignore, I don’t need it on mobile.

Also I send a message to the developper about this problem so I hope he can do something!

Update : So, same after deleting all PDF (the folder size decrease a lot), the folder sync doesn’t want to work.
BUT! With the fantastic shortcuts app from IOS I create a better way to sync with git.

Method is simple : when you open your markdown app (mine is Taio) : Pull
When you close? Commit modified and Push.


Yes you can totalement generate the name of the commit.

You can also create a log file, with details of repository…
Also, if you want a total transparent way : don’t forget the option “ask before execute”.

6 Likes

Okay, another update… Working Copy is just too touchy for my use case (which involves lots of 100+ MB files). Local repo corruption (I think? I can’t find the relevant error anywhere) is an issue, and once there’s too many large files Working Copy’s folder sync crashes on initial sync.

I’ve also pinged the dev, but as things stand now I don’t think I can recommend using Obsidian + Git LFS + iOS, at least via Working Copy. :sob:

I have not tested it (cause I don’t have such large files yet), but: I’ve just started using termux, installed git, and was able to clone, push to, pull from, my vault repo with no problem
I see git-lfs is available on termux as well, maybe that could work for you?

Yes, I sync two desktops and mobile with little trouble. I try my best to avoid using them at the same time because I’d just prefer not to have to deal with the merge conflicts in my notes. I’m confident that I can resolve them, it just usually happens at the worst possible time like when I’m already late for a meeting. :slight_smile:

I’d say if you’re not already familiar with git the learning curve will be steep: user-friendly it’s not.

1 Like

Okay, thanks to @bordache (see this post), I finally understand why my vault and folder doesn’t want to sync with Working Copy : Accented name.
So, if Working Copy doesn’t work with synced vault, and your language use accent, it’s probably that (fact : I literally don’t see accent because of habit).

If you have an accent, and doesn’t want to check all file, you can use (on windows) the cool app named PowerRename (from powertoys). Using Regex, you can manage with it ! For me, I replace all é, è, ë… with E, and the same for “à”. One day, I will find a regex with all accented characters.

But, I have the same view as @necopinus, I don’t think Git/Github is a good usage for note, mostly if you have like 1go of file (Hello <3, it’s my case). I can afford 10$/month to have Google Drive + Obsidian Sync so I will use this.

But, if you can’t, using shortcuts to pull / push each time you open and close Obsidian, it can be good!
Also, if you are a student, Working Copy is totally free and offer many cool things. I use Working Copy since months because I love programming, and It helps a lot to program on Ipad.

4 Likes

Definitely agree that git isn’t for everyone. Probably the best out-of-the-box experience will come with Obsidian’s native sync. However, for those who can’t use it or the multitude of “drive” offerings because of corporate security policies run amok, git (using GitHub or the like) offers one possible solution.

2 Likes

The dev from Working Copy has fixed the problem with accents ! It’s in the next release of the app.

1 Like

I wouldn’t say that I don’t think Git/GitHub is a good approach. Rather, my experiences so far have led me to believe that the tooling for dealing with Vaults that contain large attachments just isn’t stable enough on iOS. If I was on Android, I’d bet something like what @etienne suggests would work a lot better.

If your vault is mostly text (with no attachments over a few hundred MB and a total size ≪ 2 GB) – and you want the features that Git brings! – Working Copy seems solid.

If you don’t care about Git tracking, then Obsidian Sync is definitely easier.

If the Working Copy dev can fix some of the stability issues with LFS support and folder sync with large files, I’ll try again… But I suspect that what may be at fault are iOS limits w.r.t. the resources any one app can consume.

I have hit a show-stopping snag in setting this up. Having made changes to the vault I synced, WorkingCopy is now complaining that “The file ‘WorkingCopy’ [the name I gave my obsidian vault] couldn’t be opened because there is no such file.”

I have a repo markdown-notes, which I cloned with WorkingCopy. In Obsidian, I created a vault called WorkingCopy, and the initial “Setup Folder Sync” step seemed ok. I think there was a “Missing in WorkingCopy [ie, my obsidian vault folder] and copied from repository” message for each file in the sync dialog, and one other anomaly right at the end where a file was first “Deleted from repository to match WorkingCopy” then “Missing in repository and copied from WorkingCopy”. I don’t think that’s particularly relevant (also possible there were other irregularities I didn’t spot). FWIW that anomalous file had cyrillic characters in the filename which I suppose might have triggered an edge case.

All seemed to be well in terms of me being able to view and edit my vault in Obsidian, but when I went back to WorkingCopy to try pushing some changes, I see this error. I suppose I’ll try ‘stop syncing and remove history’ and then re-establishing the sync again. I haven’t got too much to lose, hopefully WorkingCopy will be able to sync the folder a bit quicker next time…