Use Your Own Git Server
Why I use my own Git server and why you also could do the same? Some might think this post is relevant to only technical people, or to people who do programming, to software developers. But I think it might be of interest for everyone who wants to control its own text data.
Any data which you store in the text format (like plain text, Markdown1, HTML, etc.) over time sums up and becomes huge pile of some badly structure data. It is hard to organize text files, but it also hard to track changes in such data over time, understand what and when has been changed.
Text as code
Usually people are forced to use some special tools for organization of notes and for backing them up to some sever or cloud. I mean solutions like Evernote and OneNote. They are great tools, especially their integration with the mobile devices, cloud storages, their UI is nice and attractive. But they have two big issues issues from my point of view:
- They keep notes in their proprietary format.
- Controlling of versions of notes, back them up, recover lost information is quite difficult.
I am not going deep into point №1 here, because this topic by itself requires separate post (which I will do later). As for the point №2, this was a real pain to me in both Evernote and OneNote.
Finally, after many years of trying of different “point and click” solutions, I found what I was looking for:
I treat my text data as code and I use code version control tools for it.
It might sound a bit strange from the first glance. But if we look into programming, then what is the source code of any program? - It is a collection of text files, which are formatted in a certain way (for a compiler or an interpreter). Files with this text are structured in projects and folders.
What is my text? What are my notes then? It is just some text, structured in folders and made for me and maybe other people (humans are interpreters of my text).
Programmers for years use different VCS (Version Control System) and it allows them to:
- Store their code centrally.
- Structure code in projects, folders, etc.
- Control different versions of the code:
- Split code in branches.
- Merge code.
- Roll back to previous version.
- Track changes and visualize them.
- Have a lot of text editors integrated with such VCS.
- Synchronization between multiple devices2.
Hence, if it fits programmers writing thousands line of code, then it fits my text as well.
Run your own Git(ea)
You see that treating your text data (notes, documentation) as code allows you get better tracking of the content and controlling of it. So, how can you do this?
The most popular and VCS is Git. There can be confusion around Git because there is original Git software, and Git compatible solutions, supporting the same Git protocol and different additional features. Those are Gitlab, Github, BitBucket and they offer public Git compatible services under the same names: gitlab.com, github.com, bitbucket.org.
There is nothing wrong in using those servers for your text data and projects, they all allow you to create private project repositories which no one can see. But ideally you private data shall be fully isolated and independent. Unfortunately, public services can be hacked, data might leak, they might be under DDoS attack or there can be many other privacy issues, or sudden changes in their business model, etc.
Hence, if you can, it is better to run your own private Git server (and this is what I do), which you can use for your own data only, or maybe share it with few of your friends or family members.
By my opinion, the easiest and also nice solution is Gitea. Even with basic Linux admin skills you can install it in 10 min. It is very easy to configure and switch off all unnecessary features. It is Git compatible, hence standard CLI git
client works with it just fine.
Gitea is free, lightweight and have very pleasant and clean look.
Organization of text data
- I organize my data into different projects: personal notes, web-site source text, documentation of home automation setup, etc.
- For personal notes I use VimWiki - VIM/NeoVIM extension which allows to write my notes in a “wiki” like way using very simple markup language.
- All other texts are in either TXT or Markdown formats.
Applications
I use NeoVIM and standard git
client application. Unfortunately, there are not so many simple text editors with Git client integration, but there are relatively lightweight code editors which you can use, e.g. Atom.
GitJournal is a good note taking tool for Android and iOS mobile devices.
-
It is not provided automatically out of the box, but you can automate it via some script. ↩︎