Since a few months I’m an excited user of Dendron a note-taking and knowledge management tool based on VSCode and use it with git to synchronise between different machines and mobile devices.
A recent conversation on Discord showed that it can be difficult for new joiners to get Dendron up and running with git so I thought to post a little tutorial how this can be achieved. I hope this is useful for some. If I omitted steps since they appeared too obvious please let me know and I’ll update the info.
The goal is to have a Dendron “vault” synced between at least two machines.
Step 1 Set up a Git repo
I’m using Github here as an example but any git service will work as long as all machined can access it. To create a new repo log on to Github and click on “New” on the repositories tab.
In the follwoing screen choose a name (or accept the suggested name) and decide if the repos is going to be private or public.
After creation note the git URL in the clone command on the next page and copy it.
Step 2 Create a Dendron workspace
Start Dendron and create a new workspace if you don’t have one yet using the command Dendron: Initialize Workspace
. This will create a new workspace with an empty vault that looks like this (I’m using VSCodium here)
Of course any existing workspace works just as well.
Now add a new vault via Dendron: Vault Add
and choose remote
and custom
and enter the clone URL you copied above. Dendron will create a new vault using the name and populate it with a root.md
note.
Now create notes as you see fit and commit them using the source control view from the sidebar
Finally push to the remote Github repo.
If you want you can now delete the default local vault via Dendron: Vault Remove
.
Step 3 Sync to another machine
On your other machine follow the same steps to also add a remote vault again using the git URL from above. All commited and pushed changes should be present now.
Going forward
From now on follow these steps on each of the machines:
- pull the latest changes from the Github repo
- work with your notes
- commit and push them back to the repo
There are some extensions that can be useful for working with git. One of my favourites is auto-git which - as the name suggests - automatically commits and pushes changes to a remote repository.