Hari Shaji Hari Shaji

Simple Obsidian backups

06/07/2025

I recently moved over to Obsidian from Joplin for my notes. Joplin was always slow but the latest updates just made it a lot worse. Obsidian in contrast is an absolute joy. Very fast app launches, good looking UI and most importantly: the data is plain markdown files.

But its missing something: automatic backups. Joplin had a fantastic sync feature. And I definitely wanted backups if I was to move over to Obsidian. The easiest way is to just use something like google drive to sync your Obsidian folder. But there is a nicer way: Github!

Just create a private repo on Github and set it up for your Obsidian data folder. Then run a script to push to that repo every hour if there are changes. Your data is backed up + you also get to keep old versions of your notes courtesy version control.

Here is the script I use:

# syncnotes.sh

# Configuration
NOTES_DIR=/Users/someuser/Documents/Obsidian\ Vault/
LOG_DIR=/Users/someuser/scripts/logs
LOG_FILE="$LOG_DIR/syncnotes.log"

# Ensure log directory exists
mkdir -p "$LOG_DIR"

# Timestamp header for each run
echo -e "\n== Sync Started: $(date) ==" >> "$LOG_FILE"

# Try to change directory, log and exit if it fails
if ! cd "$NOTES_DIR"; then
    echo "āŒ Failed to cd into '$NOTES_DIR'" | tee -a "$LOG_FILE"
    exit 1
fi

# Main sync logic
{
    git add --all

    # Exit early if there's nothing new
    if git diff --cached --quiet; then
        echo "šŸ“ Nothing to commit. Everything is up to date."
        echo "== Sync Finished: $(date) =="
        exit 0
    fi

    git commit -m "update notes"

    if git push origin main; then
        echo "āœ… Notes synced successfully!"
        EXIT_CODE=0
    else
        echo "āŒ Git push failed!"
        EXIT_CODE=1
    fi

    echo "== Sync Finished: $(date) =="
    exit $EXIT_CODE
} 2>&1 | tee -a "$LOG_FILE"

Run the script every hour:

0 * * * * /Users/someuser/code/scripts/syncnotes.sh

I see two major cons with this approach:

  1. What about mobile? Joplin would sync perfectly across devices. But I dont really use my phone at all. I do all my work on my laptop. If I ever needed to have another PC I would just git pull if needed there. But yes this is a painful approach. I would use the paid Obdisian Sync feature instead though its super expensive.
  2. Is Github safe? I’m not too sure. I wouldnt be surprised if they are training some AI on your repo. I just write random technical ideas and notes so I’m not too worried. I would encrypt and then push the encrypted data if I wanted to be absolutely safe.