[GUIDE] A (relatively) simple guide on syncing Windows with iOS using git

This guide kills two birds with one stone by not only syncing your vault but also periodically backing it up. The first 5 steps should be quite easy to set up. Step 6 is where things get a little complicated but if you follow along carefully you should be fine

Prerequisites (all open source):

Windows: git (Make sure 3rd party software access is enabled when installing), GitHub Desktop

iOS: iSH Shell

Step 1)

Install the Obsidian Git plug-in in Obsidian and enable it.

Step 2)

Make an account at github.com and create an empty repository.

Step 3)

Open GitHub Desktop and login to your account by selecting File > Options > Account

Now, press File > Clone Repository, and select the empty repository you just created. Where you clone this repository doesn’t matter, as long as you remember its location.

In the top toolbar once again, select Repository > Open in Command Prompt.

Paste git config --global credential.helper wincred and press enter. That should set up your credentials.

Next you want to go to file explorer and select View > Show > Hidden items. This is for windows 11 it should be a similar path for Windows 10.

Step 4)

Open the location of the cloned repository and select the formerly hidden .git folder. Cut this folder and paste it into your vault’s root directory.

Open GitHub desktop. It should normally have a notification informing you it can no longer find your repository.

Press locate, and point it to the location of your vault, which should now also house the .git folder.

GitHub desktop will have registered a vast number of changes made to your repository. This is perfectly normal. In the bottom-left corner, fill in the summary and description and then press commit.

After committing, press push origin. This button may also read Publish repository to GitHub.

At this point your vault files should be visible in your repository on GitHub and backing up should be as easy as using a hotkey in Obsidian, you can customise when to automatically backup in the plug-in along with a bunch of other options.

Huge shout out to this guide for the steps above if you want pictures to follow along please check it out.

Step 5)

Create an empty local vault in Obsidian on iOS ideally with the same name as your existing Vault. Do not click store in iCloud.

Step 6)

Open iSH and do the following:

  1. In iSH:
  2. Install git:
    1. Update Alpine repos: apk update
    2. Install git: apk add git
  3. Create a directory called obsidian in your home directory by running cd ~ && mkdir obsidian
  4. Mount your local vault folder into the obsidian folder
    1. Run mount -t ios . obsidian
    2. A file picker will show up
    3. Choose the folder with your local vault, so open the Obsidian folder and then the folder with your vault which should be empty
  5. Clone your git repository into obsidian
    1. Change directory to obsidian: cd obsidian
    2. Delete the .obsidian folder: rm -rf .obsidian
    3. git clone https://github.com/ForceBru/ObsidianVaultTest . - use your own repository instead. Don’t forget the period . - this is what allows you to clone the repo into the current folder.
    4. (Optional) Run ls -a to see whether your files are there
  6. In Obsidian
    1. Restart Obsidian (might not be necessary)
    2. Open the file explorer
    3. Use your Obsidian vault!
  7. To push your changes, go back to iSH
  8. Change directory to obsidian in your home directory: cd ~/obsidian
  9. Run git status to confirm that there are modified files
  10. Tell git who you are:
    1. Set username: git config user.name ForceBruMobile
    2. Set e-mail address: git config user.email "[email protected]"
  11. Add files, commit and push. For example:
    1. Add all files into the commit: git add .
    2. Commit: git commit -m "Commit from mobile"
    3. Push: git push
    4. That’s it! Take a look at this example commit from iSH 65
  12. To pull changes from GitHub:
  13. In iSH:
    1. Change directory to obsidian in your home directory: cd ~/obsidian
    2. (Optional) Check whether there is stuff to pull
    3. Actually update from the remote repo: git pull
  14. In Obsidian:
    1. Go to file explorer
    2. If you don’t see your new notes, do the sort trick again:
    3. Updates to existing notes seem to be reflected correctly

Again huge shout out to this guide for the steps above.

I have been using this setup for 2 days and everything seems to be working fine and it is very fast.

The bug mentioned in the steps above seems to have been fixed.

If you find the commands daunting or tedious when syncing from iOS, keep a note with the commands for pulling and pushing in Obsidian to quickly copy and paste into iSH.

Also if you come across any conflicts GitHub Desktop can be helpful to resolve the issue.

If you have any questions or suggestions on improving my guide let me know in the comments!