git_backend.md
June 29, 2026 ยท View on GitHub
HahaNote support use Git as backend to store your encrypted data.
If you can use DropBox/WebDav or other way to sync your HahaNote data, then you should not use git, see the Limits below
Tutorial on Android: https://www.youtube.com/watch?v=k-f1JKRgeVM
Tutorial on PC: https://www.youtube.com/watch?v=b_7LMknoTI4
NOTE: HahaNote can only use git to storage encrypted files, that means git can not know your files content, and the git diff and other git features not available for your files.
Limits
- Due to HahaNote database is binary file, so it can be make your git repo fast to fat, your GitHub storage maybe excedded, you can regular run below commands to clean unused git objects:
- on your local device, cd to your git dir, run
git log $(git rev-list --max-parents=0 HEAD), it will print first commit, copy the hash, then dogit reset --soft hashOfFirstCommit, thengit add -A, then dogit commit -m reset_to_first_commitandgit push --force - on git platform: go to repository settings page, and find options like "GC" or "Clean repo", then do a GC to free unused data.(note: GitHub maybe run git gc automatically, so you only need to do gc on your local machine)
- on your local device, cd to your git dir, run
On Android:
Create:
- assume your git repo named "my_git_repo", and haha note repo named "my_haha_repo"
- install PuppyGit, HahaNote need it to do git operations
- enable http service in PuppyGit and make sure allow PuppyGit running in background and disable Battery optimization for it
- create and clone your git repo in PuppyGit
- go to HahaNote, create your repo
- choose LocalDir as remote, and checked "Git backend"
- fill your git repo path that cloned just now via PuppyGit, and append your repo name, got a path like: /storage/emulate/0/PuppyGit/my_git_repo/my_haha_repo, use it as your remote path
- go to PuppyGit, select your git repo, click bottom bar menu icon, choose "Api", then copy pull/push/sync url to haha note.
- choose a path as local dir, that save your decrypted files
- set a master password to protect your data
- submit
Import
almost same as Create, just clone your git repo, and choose Import in hahanote, then fill your gitrepo/hahanote repo path, and copy pull/push/sync url from PuppyGit.
On Pc:
Create:
- assume your git repo named "my_git_repo", and haha note repo named "my_haha_repo"
- install Git: https://git-scm.com/install/
- set git to your PATH, usually is set up after you installed git, you can open an terminal and type git to verify it
- create a dedicated repo for haha note on git platform, like github/gitlab
- clone your git repo to local dir, set your git user.email/user.name, and make sure your git credential is remembered, otherwise HahaNote will got err when call git pull/push.
- use HahaNote create a "LocalDir" repo under your git repo, e.g. your git repo is /home/user/mygitrepo, then your HahaNote repo's remote can be like: /home/user/mygitrepo/my_hahanote_data
then HahaNote will auto do git pull/push when you do sync in HahaNote
Import
- install Git
- clone it
- choose "Import" in HahaNote, and choose "LocalDir", then select your cloned git repo as remote
- the other steps just like Create