Direct Git Sync
pendingby Swekit
Sync your vault natively with a private GitHub repository on both Desktop and Mobile.
Obsidian Direct Git Sync
This plugin allows you to seamlessly sync your Obsidian vault with a private Git repository across both Desktop and Mobile (iOS/Android).
By leveraging isomorphic-git, it performs Git operations natively inside Obsidian using web technologies. This means it does not rely on a native Git installation on your device, making it fully portable and perfect for mobile syncing!
✨ Features
- Complete Sync loop in one click:
Stage All -> Commit -> Fetch -> Merge -> Push. - Cross-platform: Works flawlessly on Desktop and Mobile. It bypasses mobile CORS restrictions by utilizing native HTTP network calls.
- No Git installation required: Everything runs inside Obsidian.
🚀 Step-by-Step Setup Guide
New to Git or Obsidian syncing? Follow this detailed guide to get your vault synced across all your devices. (We use GitHub in this example, but any HTTP Git provider supporting PATs should work!)
Step 1: Create a Git Account & Repository
If you don't have a Git account yet, you'll need one to store your vault.
- Go to GitHub (or GitLab, BitBucket, etc.) and click Sign up to create a free account.
- Once logged in, click the + icon in the top right corner and select New repository.
- Name your repository (e.g.,
my-obsidian-vault). - Important: Set the repository to Private so your notes remain secure.
- Click Create repository.
- Copy the repository URL (it should look like
https://github.com/your-username/my-obsidian-vault.git). You will need this later!
Step 2: Generate a Personal Access Token (PAT)
To allow the plugin to talk to your Git account securely, you need a token. For GitHub:
- On GitHub, click your profile picture in the top right and go to Settings.
- Scroll to the bottom of the left sidebar and click Developer settings.
- Click on Personal access tokens and select Tokens (classic).
- Click Generate new token (classic).
- Give your token a note (e.g.,
Obsidian Sync). - Under Expiration, select No expiration (or another timeline you prefer, but you'll have to update it when it expires).
- Under Scopes, check the box next to
repo(Full control of private repositories). - Scroll down and click Generate token.
- Copy the token immediately! You won't be able to see it again once you leave the page. Keep it somewhere safe.
Step 3: Install the Plugin
- Open Obsidian on your main device (usually your Desktop).
- Go to Settings (gear icon) > Community plugins.
- Turn off Safe mode if it's currently on.
- Click Browse and search for
Direct Git Sync(or install manually if not yet in the community directory). - Click Install, and then once installed, click Enable.
Step 4: Configure the Plugin
- In Obsidian, go to Settings > Direct Git Sync (under Community Plugins).
- Paste the Git Repository URL you copied from Step 1.
- Paste the Personal Access Token (PAT) you generated in Step 2.
- Enter your Author Name and Author Email (this will be used for your commit history on Git).
Step 5: Setup on Mobile (Phones/Tablets)
To access your vault on your phone:
- Download the Obsidian app from the App Store (iOS) or Google Play Store (Android).
- Open the app and create a new, empty vault.
- Go to Settings (gear icon) > Community plugins, turn off Safe mode, and install & enable the Direct Git Sync plugin just like you did in Step 3.
- Go to the plugin settings and paste the exact same Repository URL and PAT you used on Desktop. Fill in your author details as well.
- Click the "Sync with Git" button (the refresh icon) on the ribbon menu.
- Watch the toast notifications. The plugin will fetch all your notes from Git and populate your new mobile vault!
🔄 How to Use
Whenever you finish taking notes or want to pull updates from another device:
- Click the "Sync with Git" icon (refresh symbol) in the left/right Ribbon menu.
- The plugin will automatically save your local changes, pull any new changes from Git, merge them, and push your latest notes to the cloud.
- Watch the toast notifications in Obsidian to see the progress.
⚠️ Important Limitations
- Conflict Resolution ("Local Wins"): If a merge conflict occurs during the Sync process (i.e., you edited the exact same line in the exact same file on both your phone and computer without syncing in between), this plugin currently aborts the automated merge to prevent data loss or weird conflict markers in your files. If you get a merge conflict error, you will need to resolve the conflict manually outside of this plugin for now. Future updates will bring built-in conflict resolution.
- Authentication: Currently only supports Git Personal Access Tokens via HTTP. SSH keys are not supported.
- Token Storage: Your Personal Access Token is stored unencrypted in the plugin's
data.jsonfile within your vault's.obsidianfolder. This is standard for Obsidian plugins, but be mindful if you share your vault folder, back it up to a public location, or use a shared device. Consider using a PAT with an expiration date and only the minimum required scopes (repo).
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.