[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!

1 Like

All was going well for me until step 5 of the iSH part, where I couldn’t get the user authentication to work. I tried disabling 2FA, but it was still no use.

I found a much simpler method of syncing check out the obsidian git plugin not only can you backup your vault privately on GitHub but using the steps here you can sync too.

Let me know if you run into any problems with this method! :slight_smile:

Thank you for the suggestion. I actually decided to subscribe to Obsidian Sync because the frustration of trying to work things out was too much for me! :grinning:

Nevertheless reading about the procedure I can’t help wondering about the statement that:

If your repo is hosted on GitHub, authentication must be done with a personal access token. Detailed instruction for that process can be found here. Minimal permissions required are “Read access to metadata” and “Read and Write access to contents and commit status” for the repo you are going to use.

I already use 2 factor authentication for GitHub. How does this affect me?
A second question is would I create a classic or a fine-grained personal access token?

I would be grateful for any clarification on these.

As you may see from the above questions it’s difficult for a non-techie person to follow the instructions with ease.

Hm, you’d have to ask the creator about that I have no idea.

Thank you. I’ll experiment a bit in the future once I have some free time and if necessary I’ll contact the person who is in a position to help me directly.

Hi Notary, from the github.blog page:

The following customers remain unaffected by this change:

  • If you have two-factor authentication enabled for your account, you are already required to use token- or SSH-based authentication.

if you’re using 2fa, then you would need to use this process IF you were interacting with github in a command line way. but if you haven’t used command line interfacing before, or if you’re using git credential manager, then it isn’t really visible.

the ‘minimal permissions’ are implied instructions on creating a fine-grained personal access token, see the highlighted boxes in the create-a-fine-grained-personal-access-token interface on github: https://i.imgur.com/feBx9Wz.png