Obsidian Sync alternative: Obsidian via Git

Nazar
4 min readMay 3, 2022

Did you know that Obsidian is free forever? That’s great! And it's available on all platforms I’m using: Linux, Windows, iOS, and rarely Android.

But compared to Obsidian, Obsidian Sync is a paid feature, and the price is too high ($8 per month).

Raw Obsidian, Igneous Rock Specimen — Approx. 1"- Geologist Selected & Hand Processed

Maybe in future I’ll change my mind. But currently it is a price for good dedicated server (e.g., on DigitalOcean with premium Intel CPU + SSD and even have $2 back) that could be used for the same purpose.

On other hand, if you are already frightened of the words: “git”, “repository”, “commit”, and “distributed” — you’d better consider buying Obsidian Sync.

We are not afraid of that things, so let’s go on. I’ll use GitHub as a free place to store git-repositories. If you are not registered there, go on and register.

I’ll show how am I using Obsidian on several of my Desktop systems.

Create a repository on GitHub

  • Assume you already have a GitHub account.
  • Create a new repo here https://github.com/new
    - Give it a prominent name, like “PersonalObsidianSync”.
    - Put a description if you like.
    - Make it Private (at least for now). If it is a personal knowledge database, it should remain personal.
    - Add any .gitignore file, later we’ll update it.
Creating a new repository is always a pleasant feeling of something new…

Now you have your repo prepared.

Download repository

Now you need to download the remote repository to your Desktop to be able to work with it locally.
To do it you need to create and/or register your SSH key on GitHub. You need to do it to be on a secure side and ease your life.

“SSH”, programming zines by Julia Evans

Step-by-step instruction is on the GitHub Docs.

Clone your repo:

Copy that SSH path

On your Desktop:

  • open terminal,
  • navigate to Projects folder (cd ~/Projecrs),
  • execute the command git clone git@github.com:YOUR_ACCOUNT/PersonalObsidianSync.git
  • if it will ask you about the key, agree to believe it.

Now you have your empty repository on your local machine.

Edit .gitignore so it looks like this:

Setup new vault in Obsidian

Finally, we are back to the Obsidian app.

  • Open another vault.
  • Open folder as vault → Open.
  • Navigate to your folder PersonalObsidianSync.
  • Create an empty note, Ctrl+N, and name it “Hello Git”.

Setup Git workflow

  • Go into Obsidian settings → Community plugins.
  • Turn off “Safe mode”.
  • Browse for community plugins, and search: “Obsidian Git”. Install it then enable it.
  • In Obsidian settings, you’ll see a new item under “Plugin options”, called “Obsidian Git”. It will be “Git Backup settings”.
  • I do not like auto backups, so do not have them enabled.
  • Edit “Commit message on manual backup/commit” to Laptop: {{date}} (You can use any better identifier, it could be something like “Girlfriends PC” or “ALPHA”, …).
  • Hit “Preview commit message”, and check if you are satisfied with such messages.
  • Go to Obsidian settings and ensure that you have “Command palette” enabled in “Core plugins”.
  • Go to “Command palette” settings and pin the next commands: “Obsidian Git: Pull”, “Obsidian Git: Commit all changes”, “Obsidian Git: Push”
  • Now when you hit “Ctrl+P”, you’ll have these 3 commands pinned. Try them.
  • First, pull to check if there are any new changes. If you haven’t done any changes to the remote repo, you’ll get a message “Everything is up-to-date”
  • Since you already created a new file (Hello Git), it means you’ve done changes to the local repo. “Commit all changes”. Let’s commit it. You should get a message that “1 file was committed”.
  • Finally, push it! Hope you’ve got “Pushed 1 file to remote”.
  • Now you can open the GitHub page and check if the file was really changed.

Congratulation! Now you have your personal knowledge base pushed to the personal repository of GitHub. You can fetch this repository on another machine and continue work on your notes there. Do not forget to push your changes!

As old programmers joke say “In case of fire: git commit; git push; leave the building”. Image from https://www.reddit.com/r/git/comments/cknmqg/never_forget

Obsidian+Git on iOS

Here is a great article on how to set up iOS git-based syncing with a mobile app (using Working Copy). This approach requires using paid app Working Copy. Luckily I’ve used it for my other projects, so even with Obsidian, it got handy.

P.S.: Hope this article was helpful and gave you some more flexibility and power over your notes in Obsidian. There will be more articles with my experience described. Feel free to follow and do not miss any of it.

Also, do not hesitate to ask questions if you have any.

Good luck!

--

--

Nazar

Qt/C++/Python/QML developer, OpenSource enthusiast. Like experiments with sound creation/music and calligraphy. Fond of computer & board games. Proud Ukrainian.