Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Obsidian Git Sync: One Prompt to Auto-Backup Your Vault to GitHub

GitHub release Platform Obsidian GitHub Repo GitHub stars


Give this one prompt to Claude Code, and it will automatically:

  • Locate your Obsidian vault
  • git init + create a .gitignore tuned for Obsidian
  • Create a private GitHub repo and push your vault
  • Configure Obsidian Git plugin (auto-commit, auto-pull)
  • Set up an hourly cron fallback sync
  • Print a final summary with everything configured

No manual terminal commands. No GitHub token setup. No debugging SSH issues. One shot.


The Problem

You write daily notes in Obsidian. Your vault grows — ideas, projects, journals, your second brain. But:

  • iCloud sync is unreliable and has no version history
  • Manual git backups are easy to forget
  • Every sync guide assumes you know the terminal inside out

You need a set-it-and-forget-it backup that costs nothing (GitHub private repos are free) and takes 30 seconds to set up.

The Solution

A prompt. Paste it into Claude Code, and the agent does everything — from git init to cron job — while explaining each step. Your vault is backed up to GitHub, auto-synced every 15 minutes by the Obsidian Git plugin, with an hourly cron fallback as a safety net.


Quick Start (30 seconds)

# 1. Clone this repo
git clone https://github.com/forrestIsRunning/obsidian-sync-agent.git
cd obsidian-sync-agent

# 2. Feed the prompt to Claude Code
cat prompt.md | claude

# 3. That's it. Watch the agent do the rest.

Using Cursor, Windsurf, or another AI agent? Open prompt.md, copy the contents, and paste it into your AI chat panel.


The Prompt

Copy the entire block below into your AI agent:

You are a macOS automation expert. I have an Obsidian Vault on my local Mac. The vault path might be under ~/Documents/ObsidianVault, ~/Documents/Obsidian\ Vault, ~/Desktop, or ~ — find it.

Please complete ALL of the following steps. Before each step, tell me what you are about to do:

Step 1: Check Environment — verify git, GitHub CLI (gh), user config, and locate the vault.

Step 2: Initialize Gitgit init, create an Obsidian-tuned .gitignore (exclude workspace files, .DS_Store, .trash), git add and commit.

Step 3: Create Private GitHub Repogh repo create obsidian-vault --private --source=. --remote=origin --push. Verify the push.

Step 4: Configure Obsidian Git Plugin — check data.json for current settings, output recommended config (15-min auto backup, auto pull on startup, merge strategy).

Step 5: Cron Fallback Sync — create ~/bin/obsidian-sync.sh with git add -A, auto-commit with timestamp, pull-rebase, and push. Add an hourly crontab entry.

Step 6: Verifygit log --oneline -5, git remote -v, and a summary table.

Full prompt files:


What Gets Configured

Component Method Automation Level
Git repository git init on vault directory Fully automated
Private GitHub repo gh repo create --private --push Fully automated
Obsidian .gitignore Written by agent (excludes workspace/tmp/trash) Fully automated
Obsidian Git plugin Reads data.json + recommends settings Manual (in Obsidian)
Hourly cron sync ~/bin/obsidian-sync.sh + crontab entry Fully automated
First backup push Auto-pushed during repo creation Fully automated

What You Need

  • macOS (Ventura / Sonoma / Sequoia)
  • Obsidian (used at least once — the vault directory must exist)
  • GitHub account (free — the repo will be private)
  • Claude Code (or any AI agent with shell access: Cursor, Windsurf, etc.)

Why This Approach Works

Approach Setup Time Cost Version History Auto-Sync
This prompt 30 seconds Free Full git history Plugin + cron
Manual git 15-30 min Free Full git history Manual only
Obsidian Sync 5 min $5/month 30-day Built-in
iCloud 0 (built-in) Free None Unreliable
Dropbox 10 min $10/month 30-day Yes

About the Author

Built by Forrest — a macOS automation engineer who got tired of losing Obsidian notes and decided that a well-crafted AI prompt should do the work instead of writing yet another blog tutorial.

  • GitHub: @forrestIsRunning
  • Building: AI agent workflows, developer tooling, macOS automation

Support

If this saved you time or gave you peace of mind:

  • Star this repo — it helps others find it on GitHub
  • Share on Twitter or LinkedIn — tag me so I can connect with you
  • Follow @forrestIsRunning for more automation tools and AI agent workflows

License

MIT — free to use, fork, and share.

About

One prompt to auto-setup Obsidian vault backup to GitHub. Give it to Claude Code and it handles git init, private repo creation, obsidian-git plugin config, and cron fallback sync.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors