[Mobile] Sync with git on iOS for free using iSH

您所在的位置:网站首页 ish使用 [Mobile] Sync with git on iOS for free using iSH

[Mobile] Sync with git on iOS for free using iSH

2024-07-14 04:23| 来源: 网络整理| 查看: 265

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.

Pros:

It’s free! It lets you use fully-featured git - the same git that runs on Alpine Linux

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 running cd ~ && 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 "[email protected]" 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 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 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 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 the Obsidian 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



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3