3.4 KiB
Executable File
title, created, updated, type, namespace, tags
| title | created | updated | type | namespace | tags | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Vault Git Sync — Setup & Pitfalls | 2026-05-23 | 2026-05-23 | tech | wiki |
|
Vault Git Sync
Obsidian vault is a bare git repo on TrueNAS (mallexxx.duckdns.org:/mnt/RED_2TB/storage/git/obsidian-vault.git).
Three hosts sync to it: Eagle, Kraken, Taiga.
Sync Strategy (correct)
All hosts must follow this order:
1. stash local changes (git stash)
2. pull from remote (git fetch + git merge)
3. pop stash (git stash pop)
4. commit if anything new (git add -A + git commit)
5. push (git push)
Why this order matters: git add -A before pull stages deletions of files
that exist on remote but not locally. This caused Taiga to delete 32+ wiki files
on 2026-05-23 (two incidents: 3a44a55, c9020c4).
Scripts
| Host | Script | Status |
|---|---|---|
| Eagle | ~/scripts/sync-vault.sh |
✅ Correct |
| Kraken | ~/scripts/sync-vault-partial.sh |
✅ Correct |
| Taiga | /opt/data/sync-vault.sh |
✅ Fixed 2026-05-23 |
All scripts now use scoped git add personal/ family/ .obsidian/ (not git add -A) before stash.
Taiga additionally uses sparse checkout (only personal/ and family/) — double safeguard:
even if a bug reintroduces git add -A, sparse checkout means wiki/ is never checked out locally.
Taiga Architecture
Taiga is TrueNAS running Hermes in Docker (/mnt/RED_2TB/docker/hermes/).
The sync script runs inside the container with:
GIT_WORK_TREE=/vault→ mounted from/mnt/RED_2TB/storage/obsidianGIT_DIR=/vault.git→ mounted from/mnt/RED_2TB/storage/git/obsidian-vault.git(the bare repo itself)
Taiga IS the repo — no remote push needed. Eagle pushes to nas/main, which is this same bare repo.
Script location: /mnt/RED_2TB/docker/hermes/config/sync-vault.sh (= /opt/data/sync-vault.sh inside container)
SSH access: ssh taiga (alias in ~/.ssh/config → truenas_admin@mallexxx.duckdns.org)
To deploy a script fix:
scp ~/scripts/sync-vault-taiga.sh taiga:/mnt/RED_2TB/docker/hermes/config/sync-vault.sh
NEVER use local IP for TrueNAS — always mallexxx.duckdns.org or ssh taiga.
.gitignore
Plugin binaries are excluded to prevent cross-device obsidian-git version conflicts:
.obsidian/plugins/obsidian-git/main.js
.obsidian/plugins/obsidian-git/styles.css
.obsidian/plugins/obsidian-git/manifest.json
Each device manages its own plugin binaries via Obsidian's built-in update mechanism.
data.json (plugin config) IS tracked — shared settings across devices.
Incident: 2026-05-23
Root cause: Taiga's /opt/data/sync-vault.sh did git add -A before git pull.
Sequence:
- 22:02 UTC Eagle created 15 wiki files (
d757029,6dc4b89) - 00:00 UTC Taiga ran sync → staged deletions (local didn't have wiki/) → commit
3a44a55 - 03:02 UTC Taiga ran again → deleted 8 more files (
c9020c4)
Recovery: git checkout <hash> -- <file> for each file from last-good commits.
32 files restored in commit 620e2df.
Stash Cleanup
Orphaned stashes from obsidian-git mobile syncs accumulate. Safe to drop:
git stash drop stash@{N} # drop specific, or:
git stash clear # drop all (only if no unrecovered work)