I use an online git repository to backup my local notes and writing stuff.

With Termux and Termux Widget, we can git push to back up them effortlessly.

Requirements

  1. Termux
  2. Termux Widget
  3. Having git installed
  4. Using SSH key for your git repository

Steps

  1. Add a Termux Widget to your device’s home screen
  2. Add script files to ~/.shortcuts/

Here is an example script file that does back up or git push my note directory. It is located in /storage/emulated/0/myWriting

File: ~/.shortcuts/note_update.sh

echo 'Processing myWriting folder'  
echo '=================================' 
echo ''

cd /storage/emulated/0/myWriting/

# This is call var assignment in bash
# varAssignment=$(git status  --porcelain)

if [ -n "$(git status  --porcelain)" ]; then

  git add .
  git commit -m "note back up"
  git push
  
else
  echo 'Nothing to commit'
fi

echo 'Done all'
  1. Just click on the script files shown on Termux Widget to run them.