Updated way to sync your Obsidian vault to an Android phone using Git. Previous method can be found here.
Here’s the procedure to sync your Obsidian vault to an Android phone.
First, you’ll have to run these commands on your computer:
- Create a SSH key using
ssh-keygen -f ~/obsidian-phone-key -t ed25519 -C "your_email@example.com"
- Add the public key (
~/obsidian-phone-key.pub
) to your GitHub account - Connect your phone to your computer and allow the computer to access phone data
- Copy the private key (
~/obsidian-phone-key
) to your phone
Now, on your phone:
- Install F-Droid
- Open F-Droid and install Termux
- In Termux, install
git
usingpkg install git
- In Termux install
termu-am
usingpkg install termux-am
- Mount the phone storage using
termux-setup-storage
- Copy your SSH key into
~/.ssh/
usingcp ~/storage/shared/path/to/obsidian-phone-key ~/.ssh/
- Now go to the location you want to clone the repository (should be in
~/storage/shared/
for Obsidian to have access) and clone it usinggit clone git@github.com:username/repo.git
- You can now open Obsidian
- Open folder as vault
- Browse to the repository you copied from your computer
- Open F-Droid and install MGit
- From the settings page of MGit, import the SSH key
- SSH Keys
- Download button in the upper right corner
- Select
obsidian-phone-key
you copied from your computer
- Go back to the main menu of MGit, press the three dots in the upper right and press the
Import Repository
button - Browse to the repository you copied from your computer
- You should now be able to
pull
from MGit - Your Obsidian vault is now synced using Git!
- (Optional) If you want to also be able to manage the repository from Termux, run the command
git config --global --add safe.directory ~/storage/shared/path/to/repo