One aspect that I really love in Obsidian is the fact that your notes (and this means your thoughts, your knowledge...) are completely yours.
You are solely responsible for their safety. That’s why making a backup of your vault is crucial.
Many people confuse Obsidian Sync or having the vault stored in a cloud service, with backup.
If you have your vault stored in a cloud service, it only means that you can access it from multiple devices.
But if you lose a file? How can you restore it? Can you rely only on the recycle bin to recover your deleted files?
I suggest you to make two backups: one local backup thanks to the Local Backup community plugin, and one on a GitHub private repository that you can maintain constantly updated thanks to the Obsidian Git community plugin.
Local Backup
How to Setup
Once you installed and enabled the Local Backup plugin, open the options panel.
Here you can:
- Decide to run a local backup every time you launch Obsidian: I prefer to not enable this since I can launch Obsidian more than one time during the day. I prefer to run a local backup manually, and I will show you how in a bit.
- Set the backups’ lifecycle. I prefer to set it at
0
so I can manage my backups manually. - Decide the folder where the backups will be created.
- The name of the backup ZIP file.
- Enable the option to create backups at regular intervals. I don’t use this option since, as I already said, I prefer to run the backup manually.
- Set a file archiver (7-Zip - WinRAR): this is helpful if the size of your vault is too large.
How to Run a Local Backup
To run a local backup manually is very simple. You just need to open your command palette with Cmd/Ctrl + P
and click on “Run local backup”.
Once you have launched the command, the plugin will create a zipped backup of your vault inside the folder you chose in the “Output path” option.
GitHub Backup
What is GitHub?
GitHub is like a digital platform where people collaborate on creative projects, such as writing books or making art, but for software. It helps teams work together to create and improve software by providing a place to store and manage code, track changes, and coordinate efforts. Think of it as a shared workspace where multiple individuals can contribute and keep everything organized, making it easier to build and maintain software efficiently.
Maybe now you might wonder "why should I use this platform for my backup?".
Before answering this question, it’s important to understand another component of GitHub: the GitHub Repository.
What is a GitHub Repository?
A GitHub repository is like a digital folder or container for a specific project. It holds all the files, documents, and code related to that project in one place. Just as you'd organize your work in folders on your computer, a repository keeps everything organized for yourself (private repository) or for a team (public repository). It also tracks changes made to the project, so you can see who did what and when.
Back to the previous question "why should I use this platform for my backup?", we are going to create a private repository, that will contain our entire Obsidian vault, and we will keep it constantly updated thanks to the Obsidian Git community plugin.
Configuration and Process
Install Obsidian Git
Let’s start by installing the plugin by going to Settings > Community plugins > Browse, and search for “Obsidian Git”. Install it and enable it.
Install Git
Once the plugin is installed and enabled, you need to make sure to have git installed. To do that follow these steps:
- Open the Terminal.
- Write the following command:
which git
.
If you don’t have git installed:
- For MacOS: you can simply write this command in the terminal:
xcode-select --install
- For Windows: you can download and install Git from HERE.
GitHub Desktop
The next step is installing GitHub Desktop. This is not mandatory, but since a lot of people are not familiar with terminal, GitHub Desktop will help you to achieve the same result without using any commands!
Once you have installed it, launch it and you will see a window like this:
If you don’t have a GitHub account, create it and once you’ve done this, you can sign in!
Create a Local Git Repository
Now you need to create a Git Repository on your hard drive. To do that follow these simple steps:
- Click on “Create a New Repository on your Hard Drive…”.
- Create a folder in the same folder where your vault is located and call it whatever you want – I call it “Git Repo” – and select it.
- Choose a name for your Repository and click on “Create repository”.
- Open the folder you created before – for me it’s “Git Repo” –, open the local repository – for me “test-vault-obsidian-sync” – and enable the option to view hidden files.
- For MacOS: use the shortcut
Cmd + Shift + .
. - For Windows: go to View > Show > Hidden items.
Inside the folder you will see two files: the folder .git
and the file .gitattributes
.
- Move that folder and that file to your vault folder.
- Go back to GitHub Desktop and you should see a “Can’t find…” error.
- Just click on “Locate” and select your vault folder.
- Now it will see all the files you have in your Obsidian vault.
- You can now delete the folder you created at the step 2 of the process – for me it was the “Git Repo” folder.
Publish Your Repository to GitHub
- Commit your vault. Think of commit as a snapshot of your work, allowing you to save and keep track of changes you make in your vault. I name this commit “First Commit” but you can name it whatever you want, and click on “Commit to main”.
- Once this process is finished you need to publish the repository. To do that, click on “Publish repository”.
- Give it a name and make sure to check “Keep this code private” or your repository will be public. Lastly, click on “Publish repository”.
- If you go to your GitHub account, you will see your vault inside the repository!
How to Set Obsidian Git Plugin
Finally you are ready to set the Obsidian Git plugin!
- If you have Obsidian opened, close and relaunch it.
- Go to Settings > Obsidian Git and customize the settings you want. In my opinion the most important one is the “Vault Obsidian Interval”.
- If you open your command palette with
Cmd/Ctrl + P
and you search for “Obsidian Git: Open source control view”…
…you can see all the changes to your vault and decide to commit and push them manually!