5.1 KiB
link, author, published, created, tags
link | author | published | created | tags | ||||
---|---|---|---|---|---|---|---|---|
https://forum.obsidian.md/t/mobile-sync-with-git-on-ios-for-free-using-ish/20861 |
|
2021-07-14 | 2025-05-08 |
|
There’s already a post about syncing with WorkingCopy ([Mobile] Setting up iOS git-based syncing with mobile app (using Working Copy)). However, the ability to push is paid, and it costs a lot, but without this there can be no sync!
I propose to use iSH to sync Obsidian with git.
- p Pros:
- It’s free!
- It lets you use fully-featured git - the same git that runs on Alpine Linux
- c Cons:
- It requires using the Linux command-line
- There appears to be a bug in Obsidian 1.0.3 that doesn’t show new files in the file explorer after you pull them from GitHub. This can be easily circumvented by sorting the notes
Tutorial
Also see the example repository I created to showcase this method.
Also see “Simpler way” below.
Assuming you have an existing repo on GitHub. You can also create the repo right from iSH - the git
command you’ll be using is the exact same fully-featured git
from Alpine Linux.
- Create a new empty local vault in Obsidian
- In iSH:
- First-time setup - install git:
- Update Alpine repos:
apk update
- Install git:
apk add git
- Create a directory called
obsidian
in your home directory by runningcd ~ && mkdir obsidian
. - Mount your local vault folder into the
obsidian
folder - Run
mount -t ios . obsidian
- A file picker will show up
- Choose the folder with your local vault
- Clone your git repository into
obsidian
- Change directory to
obsidian
:cd obsidian
- Delete the
.obsidian
folder:rm -rf .obsidian
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.- (Optional) Run
ls -a
to see whether your files are there
- In Obsidian
- Restart Obsidian (might not be necessary)
- Open the file explorer
- Currently (Obsidian 1.0.3) it’s empty (looks like a bug)
- Tap the “Sort” button (the rightmost one, with up/down arrows)
- Select any sorting order you like
- The files should appear
- Use your Obsidian vault!
- To push your changes, go back to iSH
- Change directory to
obsidian
in your home directory:cd ~/obsidian
- Run
git status
to confirm that there are modified files - First-time setup - tell git who you are:
- Set username:
git config user.name ForceBruMobile
- Set e-mail address:
git config user.email "ForceBru@users.noreply.github.com"
- Add files, commit and push. For example:
- Add all files into the commit:
git add .
- Commit:
git commit -m "Commit from mobile"
- Push:
git push
- This will ask you to enter your username and password
- Git can use your personal access token to login automatically
- That’s it! Take a look at this example commit from iSH
- Change directory to
- To pull changes from GitHub:
- In iSH:
- Change directory to
obsidian
in your home directory:cd ~/obsidian
- (Optional) Check whether there is stuff to pull
- Bring remote refs up to date:
git remote update
- Check status:
git status
- It should say something like
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded
if there is something to be updated - Actually update from the remote repo:
git pull
- Change directory to
- In Obsidian:
- Go to file explorer
- If you don’t see your new notes, do the sort trick again:
- Tap the “Sort” button (the rightmost one, with up/down arrows)
- Select any sorting order you like
- The files should appear
- Updates to existing notes seem to be reflected correctly
- In iSH:
Simpler way
Mount the entire Obsidian folder which contains all your vaults (as opposed to mounting just the vault).
In iSH:
- Make directory to store Obsidian vaults:
cd ~ && mkdir obsidian
- Mount the file provider:
mount -t iOS . obsidian
- Choose
On My iDevice
and select and open theObsidian
folder - Change directory to
obsidian
:cd obsidian
- Clone the repo with your vault right there:
git clone https://github.com/ForceBru/ObsidianVaultTest
- This will create a folder called
ObsidianVaultTest
that will be a git repo and that Obsidian will recognize as a vault
Then open the vault in Obsidian (might need to restart it), edit stuff, then push/pull changes as described in steps 3 and 4 in the original post.
To avoid entering login/password all the time, cache or store your credentials: Git - Credential Storage