Taking notes is a great way to build a knowledge database for yourself. I've been searching for a good solution to this, which is not dependent on a single company, as they could wipe out everything I've built up over the years if they decide to cancel the service, get hacked or go bankrupt. I also want privacy, which is hard to come by and my solution isn't perfect, unless you self-host, but I'll get to that.
A few things I want:
- Notes have to be accessible on my Android phone and my Linux system.
- Notes have to sync between devices.
- Notes have to be in Markdown.
An obvious solution to the syncing between devices is using Git. You can use any of the Git services out there and you can even have a backup repository on another Git service by mirroring your main repository. This means you have a backup were the main service to disappear for whatever reason. You can even mirror to several services if you want even more security.
Hosting your notes on external Git services obviously is relying on outside servers. This means that even if you set your repository as private, which hides it from the public, the service can still see its content. If you'd like to avoid that, you could always self-host your own Git service.
Whichever way you go, set up a repository for your notes. I'll name mine "Notes" and clone it to ~/Notes on my Linux system.
The software for Linux is a no-brainer. We'll be using Obsidian. It is hands down the best note taking app on Linux. There is one massive downside to it and that is that it isn't open-source, however we can live with that as the software will just use straight up markdown files, so if and when a better open-source application pops up, we can simply switch to that. For now though, after testing many others, none are as good as Obsidian.
Make sure you set the location of your vault to be the folder in which you cloned your Git repository. So for me that's ~/Notes.
In Obsidian we will need one important plugin from the community plugins, and it is called Obsidian Git. This is needed to automatically pulls in changes made to the repository on startup of Obsidian. How to go about installing plugins is outside the scope of this article, but Obsidian provides information on it on their website. Do be sure you toggle the "Pull updates on startup" toggle on in the plugin's settings.
For pushing though, I am not that happy with this plugin, so I am doing it manually through the terminal.
On Android it's a matter of installing one app. We'll be using GitJournal, which is available in both the Play Store and on F-Droid. Setting up the app is as simple as generating an SSH key with the application and importing that into your Git service. For example, like so on GitHub, or like this on GitLab.
Next you'll want to go through the settings of the app and add your author name and email address. After that, you're pretty much done. This application will pull in the latest version of your notes on boot and will auto push on save as well. You can also click the little cloud icon to do so manually.
GitJournal is an open-source app, but has a pro option. There's also KPassNotes, which is also open-source but does not offer a pro version. I however haven't been able to get it to work with GitLab, but perhaps you're smarter or luckier than I am.
And that's it. After setting it up, it's a nearly pain free way to have your notes cross-platform in markdown syntax and backed up on Git without relying on (paid) services that would love to have the data you add to your notes.