Working with Git on Android
December 21, 2020
3 minute readdendron software productivity
Recently I started to use Dendron which is a fantastic knowledge management software based on Visual Studio Code. Notes are written in markdown and stored in so-called ‘vaults’. These can also be git repositories.
After setting it up and working with a growing base of notes I wondered how to best sync this to Dendron across multiple devices (private and work laptop). Thinking of it I realised that this is a problem git was made to solve. Hence I moved everything into a private git repo on GitHub. So my knowledge base is in sync and current between my work and private laptop. The missing piece were my mobile devices: an Android phone and tablet.
An app I use regularly on my mobile devices is Neutrinote. Neutrinote follows a somewhat similar philosophy as Dendron: a flat folder and a excellent search capability. So it felt natural to use it as my mobile editor. My main set of notes and references lives in a folder on my device used by Neutrinote.
Initially I used FolderSync a nice app which allows me to sync that folder with my Nextcloud instance. But this meant I had to regularly remember to commit and sync that folder to have the changes also available on my work laptop.
Turns out there are easy ways to have git on an Android device. The app I use is Mgit and here is how I set it up:
- install MGit from the play store
- create a new personal access token on GitHub. The reason for this is that I didn’t manage to get ssh keys to work.
- Add a default folder for your repos as well as your name and email in the MGit settings
- Clone my private repo. I used the access token instead of a password with my usual userid.
- For Neutrinote to find the files I chose a name different from the repo name in MGit.
Once this is done the repo is available for any markdown editor that reads the file system. Beside my favourite app Neutrinote I tried Droidedit, Markor and Epsilon which are also great editors.
This is now my workflow which is a basic git workflow:
- I pull all changes to my device
- I create, edit and delete notes
- I commit and push
- Back in Dendron I run Dendron: Doctor to add the required frontmatter.
There are other options like Gitjournal which has the added advantage that it is also available for iOS and commits, pushes and pulls automatically. The main reason I prefer my setup above is that Neutrinote makes it easy to take notes while reading on my tablet. I can simply mark text and share it into an existing note in Neutrinote. In fact I use both Neutrinote and Gitjournal: the former to add to my knowledge base while using mobile and the latter for quick notes and ideas.
Should I replace my Android tablet by an iPad in the future a similar workflow is possible thanks to Working copy as described here