
Sync an Obsidian Vault with Git
Desktop: Obsidian Git plugin
Open a terminal and run the following command to generate an SSH key:
ssh-keygen -t ed25519Press Enter to accept the default file location.
In the terminal, run the following command to display the public key, then copy the full output:
cat ~/.ssh/id_ed25519.pubSign in to GitHub and go to Profile picture → Settings → SSH and GPG keys → New SSH key. Enter a title, paste the public key into the Key field, and select Add SSH key.
Return to the GitHub dashboard and select New to create a repository. Give it a name, set its visibility to Private, and create it.
On the repository page, select Code → SSH, then copy the repository URL.
In a terminal, go to the directory where you want to keep the vault and clone the repository:
git clone <repository-url>Before opening the vault in Obsidian, create or update
.gitignorein the cloned repository root and include:.DS_Store .trash/ # Device-specific Obsidian state .obsidian/community-plugins.json .obsidian/workspace*.json # Installed plugin bundles; install plugins separately on each device .obsidian/plugins/*/main.js .obsidian/plugins/*/styles.cssCommit and push
.gitignorebefore setting up another device. If.obsidian/community-plugins.jsonwas previously committed, remove it from tracking without deleting the local file:git rm --cached .obsidian/community-plugins.json git commit -m "Keep enabled Obsidian plugins device-specific" git pushInstall Obsidian, select Open folder as vault, and choose the cloned repository folder.
In Obsidian, go to Settings → Community plugins, enable community plugins, and select Browse. Search for Git, install it, and enable it.
The enabled-plugin list is device-local, so plugins must be enabled independently on each device.
In the Settings sidebar, select Git and configure the following fields.
Automatic
- Split timers for automatic commit and sync: Off
- Auto commit-and-sync interval (minutes):
1 - Auto commit-and-sync after stopping file edits: On
- Auto commit-and-sync after latest commit: Off
- Auto pull interval (minutes):
1 - Auto commit-and-sync only staged files: Off
Pull
- Merge strategy: Merge
- Merge strategy on conflicts: None (git default)
- Pull on startup: On
Commit-and-sync
- Push on commit-and-sync: On
- Pull on commit-and-sync: On
Mobile: GitSync app
- Install GitSync from your device’s app store.
- Open Auth, sign in to GitHub, and grant GitSync access to the vault repository.
- Open Clone and find the vault repository.
- Select the download icon beside the repository, choose Nested Clone, and select the folder where the vault should be stored.
- Open that folder as a vault in Obsidian.
- Enable the community plugins needed on mobile, but leave Obsidian Git disabled because GitSync handles mobile synchronization.
- In GitSync’s sync settings, add Obsidian as the linked app and enable sync when Obsidian opens and closes.
Keeping the enabled-plugin list device-local prevents mobile from disabling Obsidian Git on the desktop if the plugin fails to load on mobile.
Device-specific plugin state
Obsidian stores the list of enabled community plugins in .obsidian/community-plugins.json. Keep this file ignored because Obsidian may
remove a plugin from the list when it fails to load on one device. If the list
were shared, that change could disable the plugin on every other device after
synchronization.
The installed plugin bundles (main.js and styles.css) are ignored, so each
plugin must be installed and enabled separately on every device. Plugin
configuration files under .obsidian/plugins/ remain shared unless explicitly
ignored.
Note about one-minute desktop sync
The desktop Git plugin only runs while Obsidian is open. With Auto commit-and-sync after stopping file edits enabled, each new edit restarts the one-minute timer, so continuous editing can delay the commit and push. The one-minute pull interval also checks periodically rather than delivering phone changes instantly. Avoid editing the same note on both devices before they have finished syncing, as this can cause a Git conflict.