Build Obsidian Sync

YESreplaces $5/mosaves $60/yrback to the verdict

0%0 of 18 items done

Saved on this device only. Tick prerequisites first, then work the phases in order · do not start one until the checks above it pass.

Sync for your Obsidian vault using git: a watcher commits and pushes after you stop typing, pulls with rebase on a timer, never loses either side of a conflict, refuses to push a suspicious mass deletion, and a status command tells you where things stand. Your phone uses a git client against the same repository.

estimated effort one sittingthe files for this build are in the project pack

Syncgit with a private remoteWatcherA bash script on a systemd timer or launchd agent, or Node with chokidarMobileWorking Copy on iOS, a git client on Android

Before step 1

Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.

  1. installfree

    Why Every step below is a command you type or a file you edit.

    Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗

    Verify You can open a folder and run a command in its terminal

  2. installfree

    Why History for your code, and the way most hosts deploy.

    Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗

    Verify git --version prints a version

  3. have readyfree

    Why You are about to automate commits in it. Take a plain copy before Phase 1 so nothing is at risk while you learn.

    Get it Copy the vault folder to an external drive or a zip.

  4. free

    Why The remote is the sync point. Private, because these are your notes.

    Get it Create an empty private repository. For pushing without passwords, add an SSH key: ssh-keygen -t ed25519, then add the public key in the host's SSH keys settings. open ↗

    Verify ssh -T git@github.com greets you

  5. have readyfree

    Why Every phase is tested across two devices; one machine cannot test sync.

    Get it Another computer, or a phone with a git client.

  6. installfree to about $20 one-time

    Why Phase 6: the phone reads and writes the same repository.

    Get it Working Copy on iOS (one-time purchase for push), MGit or GitJournal on Android. open ↗

Environment variables

These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.

VariableNeededExampleWhere the value comes from
VAULT_PATHrequired/Users/you/NotesAbsolute path to the vault.
REMOTErequiredoriginGit remote name.
DEBOUNCE_SECONDSoptional30Wait this long after the last change before committing.
PULL_INTERVAL_MINUTESoptional5How often to pull with rebase.
MAX_CHANGED_FILESoptional100Refuse to auto-commit a change touching more files than this.

The build, in order

  1. Repository hygiene

    A vault that does not produce a diff just from being opened.

    1. .obsidian/workspace*, .obsidian/cache, .trash/, .DS_Store. Keep the rest of .obsidian if you want settings to travel.

      Files .gitignore

      terminal
      cd $VAULT_PATH && git init && git remote add origin git@github.com:you/notes.git
    done when · tick each as it passes
  2. Manual round trip

    Do the loop by hand before automating it.

    1. terminal
      git add -A && git commit -m 'notes' && git push -u origin main
    2. terminal
      git pull --rebase
    done when · tick each as it passes
  3. The watcher

    Debounced commits, timed pulls, one git operation at a time.

    1. Debounce DEBOUNCE_SECONDS after the last change, git add -A, commit with the changed-file count, push. Pull --rebase on start and every PULL_INTERVAL_MINUTES. Take a lock file so a commit never races a rebase.

      Files vaultsync.sh

    2. terminal
      systemctl --user enable --now vaultsync.timer
    done when · tick each as it passes
  4. Conflicts, without data loss

    Both versions survive, the vault is never left mid-rebase, the daemon keeps running.

    done when · tick each as it passes
    watch out
    • Test this before trusting the sync with anything you care about.
  5. Status and safety

    Know the state, and never propagate a mass deletion.

    done when · tick each as it passes
  6. Mobile and second machine

    Documentation only: a phone and another computer set up from the README.

    1. Files README.md

    2. Working Copy on iOS, MGit or GitJournal on Android.

    done when · tick each as it passes
what this build does not replace
after v1, if you want it

Need the files? The project pack on the verdict page hands your agent the whole brief · more notes & knowledge.