Backing up Your Obsidian Vault on Github (for free!)

A picture of the Github octocat.

Backing up your obsidian vault on Github is a great way to keep and maintain ongoing backups of your Obsidian Vault. Github offers both public and private repositories for free, so it’s a good option if you want free backups for your Second Brain. There are many more options when it comes to backing up Obsidian, but Git is one of my favorites, because it has saved my notes many times.

However if you’re new to git or Github, the process can be a bit intimidating. Here’s one way to get this set up that should be straightforward for beginners and experts alike.

What are git and Github?

If you’re new to git, Github, or version control in general, here are a few important definitions:

  • version control system: A software package that keeps a history of changes to any set of text files.
  • git: A free and open source version control system.
  • git repository: A folder of text files that uses git to keep track of its history.
  • Github: a platform for hosting git repositories, with some social media-like features.

Many people get git and Github confused. git is free software that you can run on any computer. Github is a website that helps you use git. Even though Github is a software company, they still offer their services for free for most people, which is one reason why backing up your obsidian vault on Github can be such a good way to go.

Downsides

There are two main downsides to backing up your Obsidian vault on Github:

  1. If you haven’t used git or Github before, there is a bit of a learning curve. Hopefully this article helps with that.
  2. You don’t control your own data. Microsoft owns Github, so even if you use a private repository, there’s no guarantee that they won’t data-mine your data.

If you’re worried about privacy, there are better options out there than Github. But it’s a great platform for all but the most sensitive information: it’s free, fast, and easy to use.

If Github still sounds like a good option to you, then let’s get started:

Step 1: Download an app

If you’ve never used git before, the easiest way is to use an app. Github Desktop is popular on Windows and Mac. If you want something fully cross platform, Sublime Merge is a lightweight and fast option (but not free). We’ll use Github Desktop for this tutorial, but the steps are similar no matter what app you use.

Step 2: Create a local repository

A git repository is a folder controlled by git. You can create a git repository out of any folder on your computer. In this case, you’ll want to create a git repository out of your Obsidian Vault.

If you’re using Github Desktop, this is a bit unintuitive. You’ll want to select “New Repository” from the File menu, and select the parent folder for your vault. Then type the exact name of your vault inside the “Name” field. That should look like this:

Creating a repo in Github Desktop.

For example, if your Vault is named MyVault inside your “Documents” folder, select “Documents” and type “MyVault”. This won’t actually create a new folder, as long as you use the exact name of your existing folder.

Then click “Create Repository”. Github Desktop will then automatically commit all of your current files, creating your first “commit”.

What is a commit?

One more definition for you: a commit is a snapshot of a moment in time. When we created a repository using Github Desktop, the app automatically created your first commit. If you go to the History tab, you can even see your first commit:

The history tab in Github Desktop.

On the left side of the screen, we can see the commit message, which says “Initial commit”. In the middle are all of the file changes (your list will be much longer, probably). If you click on one of the file names, the changes will show up on the right.

Every time you make a change to your git repository, you have to commit to that change with a commit. This is the backbone of git, and how you’re able to store and see the entire history of your files. We’ll walk through a commit in a minute, but first let’s get your Vault stored in Github.

Step 3: Save your vault to Github

Now that you have a local repository, you can send it to Github. The Github Desktop app makes this particularly straightforward.

Find the button that says “Publish repository” (top right of the screen), and click it. You should see this:

The Publish Repository overlay in Github Desktop, asking me to log in to Github.

Click the “Sign In” button, and either create an account or log in with an existing account. Once you do, click the “Publish Repository” button again, and you’ll see this instead:

The Publish Repository overlay in Github Desktop.

Click “Publish Repository”, and Github will automatically send your files to their servers. You can make your repository public if you want, I would recommend leaving it private.

Congratulations! Your vault is now backed up for free on Github.

Step 4: Making changes

Now that your files are encapsulated in a git repository, there is a little more maintenance work you have to do. Every time you make changes to your vault, you’ll have to save those changes by making a commit.

If you make a change to your vault and go back to the Github desktop app, the app will show you exactly the changes you just made. It will look something like this:

Showing file changes in Github Desktop.

If you’re happy with the changes you made, then you can commit to them. You can just click the blue button that says “Commit to main”, or you can enter your own commit message in the box above the button:

Showing a commit message in Github Desktop.

Commit messages and descriptions are both optional in Github Desktop, but writing good commit messages can be useful if you ever have to go back and find a particular commit. But it’s totally up to you.

Once you’ve committed, you can again go to the history tab to see the changes you made:

Viewing commits in Github Desktop.

And press the “Push origin” button at the top of the app to sync your changes with Github.

The Push origin button in Github Desktop.

And just like that, your work is now version-controlled and backed up with git and Github. Congratulations! It may not seem like much, but that is a huge deal, and has the potential to change and improve your work forever.

Committing via plugin

If you don’t like manually committing, you can use a plugin to do this for you. Obsidian Git is a community plugin that allows you to automatically create commits and automatically sync to Github. You’ll still have to create the repository locally and on Github, but once you do, this plugin allows you to set it and forget it, which is nice.

Summary

Backing up your Obsidian vault on Github has never been easier. You can do it manually, automate it with a plugin, or use an app, all methods we’ve discussed above. It may require learning some new terminology and skills, but if you put in the time and effort, you will reap many rewards.

5 responses to “Backing up Your Obsidian Vault on Github (for free!)”

  1. I have followed Tim Miller’s post ‘Backing up Your Obsidian Vault on Github’ and it would seem I need some help from Tim.

    I have followed the post through step three. I can see all my files in the GitHub Desktop with a green plus sign inside a green square. I have tried several times to publish the branch to GitHub and it always returns “Error- -The remote disconnected. Check your internet connection and try again.” I have tried several times.

    When I run the command ‘git clone https://github.com/Ken9969/-Obsidian-Backup.git‘ with the proper user name and token password, I get this returned: ‘warning: You appear to have cloned an empty repository.’

    I have tried everything I can think of. I would seem to need some help.

    Regards,

    Ken

    1. Hi Ken! It sounds like your Github Desktop app is having trouble connecting to the internet. Do you have any sort of firewall on your computer or network? If there’s a firewall somewhere on your network, it might be blocking Github Desktop from accessing the internet.

      It sounds like you’re somewhat familiar with the command line. If so, you could try to cd into your Obsidian Vault directory, and run git push manually. You may have to follow these instructions from Github to set this up, but this method would get around any issues having to do with the Github Desktop app.

  2. Thanx, for the response Tim. Unfortunately, that did not work though the process lasted several hours. I hope you have some more ideas. Here’s the result:

    Obsidian Backup % git push -u origin main
    Enumerating objects: 9952, done.
    Counting objects: 100% (9952/9952), done.
    Delta compression using up to 16 threads
    Compressing objects: 100% (8833/8833), done.
    error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
    send-pack: unexpected disconnect while reading sideband packet
    Writing objects: 100% (9952/9952), 3.34 GiB | 153.00 KiB/s, done.
    Total 9952 (delta 1091), reused 9952 (delta 1091), pack-reused 0
    fatal: the remote end hung up unexpectedly
    Everything up-to-date

    I followed with this:

    git clone https://github.com/Ken9969/-Obsidian-Backup
    Cloning into ‘-Obsidian-Backup’…
    warning: You appear to have cloned an empty repository.

    Regards,

    Ken

    1. Hi Ken, it looks like you’re running into GitHub’s 2GB push limit. You also have a slow internet connection, which makes this harder!

      I can’t tell how many commits you have made, but assuming you’re starting from scratch, I think the easiest way to deal with this would be:

      • Delete the hidden .git folder inside of your Obsidian Backup folder
      • Go back to Step 2 and create a new repo inside of Github Desktop
      • Do not commit all files at once. Commit maybe half of your files, making sure the included files are under 2GB in total size
      • Push the first commit. If you get the remote disconnected error again, you may have to push from the command line.
      • Commit the rest of your files, ensuring this commit is also under 2GB in size
      • Push again

      Be careful deleting files: deleting the .git folder should be safe (it only deletes your commits, not any of your files). But you might want to duplicate the folder first, just to make sure you don’t lose any work.

  3. Thanx Tim, I’ll get right on this tomorrow. I’ll ket you know how it goes.

Leave a Reply

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