Synchronize Vault on Multiple Machines using Git

I use a linux machine and my mac interchangeably for various tasks. I love Obsidian and wanted to use git to synchronize my work vault on both machines. Using git with Obsidian works seamlessly. If you are familiar with the command line then you can create a private (public if you want) repo and then push your repo to github. From there you can manually sync the vaults using git.

For those less familiar with github:

  1. Create a repo
  2. Navigate to your vault on your computer and execute the following commands.
$ git init
$ git commit -A
$ git remote add origin (url of your repo)
$ git push -u origin master

From there you can manage your vaults using git. A gentle introduction to the world of git can be found here.

6 Likes

Yes. There’s an app that already does it, https://github.com/GitJournal/GitJournal, but I would like Obsidian to do it out if the box.

One downside of this simple method is that mtime (file modification time) is not preserved in git, so the files end up all mixed up.

To fix that, you could use a tool like git-store-meta.

I put together a short explanation of how to glue everything together in this repo.
Contributions are welcome and hope it helps somebody!