I take handwritten and PDF notes using the Notewise app on my tablet.
Over time, I ran into three major issues:
-
Duplicate Chaos
- Notewise saves updated versions as new files like
mysql (1).pdf,mysql (2).pdfinstead of overwriting the old one. - This clutters my folder and makes it confusing to figure out which file is the latest.
- Notewise saves updated versions as new files like
-
Manual Sync is a Pain
- I had to manually move files, delete older ones, and push updates to GitHub every time I made a change.
-
Cross-Device Access
- I wanted to instantly access my updated notes on my phone or laptop without manual uploads.
I needed a solution that was automatic, reliable, and clutter-free.
This repository is powered by an automated script running in Termux on my Android tablet.
It continuously monitors my notes folder, detects changes, removes outdated versions, and pushes the latest files to GitHub automatically.
- Only the most recent version of each note exists.
- No duplicate file names like
(1),(2), etc. - Instant sync — as soon as I save a note, it’s live on GitHub.
- Works quietly in the background via
tmux.
The automation uses:
- Termux → Runs the script on Android.
- inotifywait → Watches the folder for file changes in real time.
- Git + SSH → Securely pushes updates to GitHub without password prompts.
- tmux → Keeps the script running in the background.
- Duplicate cleanup logic → Finds and removes older versions of the same note.
Follow these steps to set up your own version.
Note: Replace placeholders like <your_email@example.com> and <your_github_username> with your actual details.
I’ll also give my own folder path as an example so you know what it looks like.
- Download Termux from F-Droid (recommended) or Google Play.
- Open Termux and run:
This will create a
termux-setup-storage
storagedirectory inside Termux that links to your Android storage.
📌 Example (my Notewise folder path):
/data/data/com.termux/files/home/storage/shared/My Notes
Yours may differ — check where Notewise saves your notes.
In Termux, run:
pkg update && pkg upgrade
pkg install inotify-tools poppler tmux git- inotify-tools → watches folders in real time.
- poppler → checks PDF details if safety checks are used.
- tmux → keeps the script running in the background.
- git → manages commits & pushes to GitHub.
-
Generate a new SSH key:
ssh-keygen -t ed25519 -C "<your_email@example.com>"Press Enter for all prompts (no passphrase).
-
Show your public key:
cat ~/.ssh/id_ed25519.pubCopy everything shown.
-
Add it to GitHub: GitHub SSH Keys Settings → New SSH key → paste → Save.
-
Test connection:
ssh -T git@github.com
Replace <your_github_username> with your username:
git clone git@github.com:<your_github_username>/My-Notewise-Notes.gitThis creates the My-Notewise-Notes folder inside Termux.
nano ~/watch-notes.shPaste your watcher script logic here.
The script should:
- Watch your Notewise folder.
- Remove older versions of the same file.
- Copy the latest to your repo folder.
- Commit & push to GitHub.
Save & exit (CTRL+O, Enter, CTRL+X).
Make it executable:
chmod +x ~/watch-notes.shStart a tmux session:
tmux new -s notes ~/watch-notes.sh- Detach:
CTRL+B, thenD - Reattach:
tmux attach -t notes
nano ~/.bashrcAdd this at the bottom:
if ! tmux has-session -t notes 2>/dev/null; then
tmux new-session -d -s notes "$HOME/watch-notes.sh"
fi- Save or update a PDF in your Notewise folder.
- The script should detect it, remove older tracked versions, and push the latest one to GitHub.
- Check your repo to confirm the update.
- Back up first — This deletes older versions of notes in the repo.
- The script is tailored for PDFs but can be adapted for other file types.
- Make sure Termux has storage permissions enabled.