Use Git to backup Obsidian Vault

Create Github Account

The first thing we need to do is create a Github account if we already don’t have any. Not a rocket science. Mainstream Sign Up process.

Download Github Desktop App

Go to this link and download the the latest version (preferred) version according to your OS.

Setup Github App

Open Github Desktop and then login to your github account.

Create a New Repository

Create a Click on Files and then Click New Repository or Press Ctrl+N

obsidian github repository

Now name your repository use Underscore ( _ ) or Hyphen ( – ) instead of Space. And choose a Local Directory as your preffered in the Local Path.
Please Note: We'll be using this path for Obsidian to save everything in this folder or as the Vault. So choose the Local Directory that you want Obsidian to use as your Vault

obsidian github repository

After Creating the Repository Click on “Publish” and Keep it Private (Tick the option if not already ticked) unless you want anyone to See your Notes.

Now show Hidden Items

obsidian github repository

And you should see two things there .git folder and .gitattribute file there.

We are done setting up our Github Repository.

Download Obsidian

Now go to this link and download the Latest version (Preffered) of the Obsidian. Install and then Open.

Setup Obsidian

Now instead of Creating a new vault click Open folder as vault

obsidian github

And Choose the Github Repository Local Path as the vault folder (where .git and .gitattribute files are located)

Now Obsidian will take necessary steps (create .Obsidian folder) there and open the folder as vault. Create a Note or Folder and see if your Directory shows that file/folder. It should immidiately show whatever you create in Obsidian in that folder.

Connect Obsidian with Github

Go to Settings and then “Community Plugin” and turn it on.

obsidian github

obsidian github

In Community plugins option Click Browse and search for git and install the plugin.

obsidian github

obsidian github

Activate the plugin

obsidian github

obsidian github repository

Click Command Palette and search source control

obsidian github repository

and select that. It will show a panel in the Right Side of the Obsidian Panel. From there we can Commit, Push, Backup etc. from that panel.

obsidian github repository

Now whenever we need to do send our update to github, we need to click Stage all and then Commit and then Push Everything will be updated and uploaded to Github.

Note: You must have Git installed to execute Git commands
If you already don’t have git installed then install it.

And We are done. Now our Obsidian is conencted with our Github Private Repository.

Auto Backup Setting

Click on the Settings and from the Community Plugins Tab Click Obsidian git and setup your backup plan like you want.

obsidian github repository

You have several options to tweak here for the Obsidian Git plugin. Hope you can manage to set this up according to your need.

Leave a Reply

Your email address will not be published. Required fields are marked *