Skip to main content

Sync Obsidian vault to GitHub with wiki-link transformation

Project description

ob-sync

PyPI version Python 3.9+ License: MIT

A CLI tool to sync your Obsidian vault to a GitHub repository with automatic wiki-link transformation.

Features

  • 🔄 Sync Obsidian notes to a GitHub repository
  • 🖼️ Transform wiki-style image links (![[image.png]]) to raw GitHub URLs
  • Incremental sync - only processes changed files (using MD5 hashes)
  • 📤 Auto-push to GitHub after sync using local ssh keys (super simple)

Installation

From PyPI

pip install ob-sync

From source

git clone https://github.com/sounak07/obsidian-transformer.git
cd obsidian-transformer
pip install .

Development install

pip install -e .

Configuration

ob-sync requires a configuration file at ~/.config/ob-sync/config.yaml.

Setup

  1. Create the config directory:

    mkdir -p ~/.config/ob-sync
    
  2. Create the config file:

    touch ~/.config/ob-sync/config.yaml
    
  3. Add your configuration (see example below)

Configuration File

# Path to your Obsidian vault folder
vault_path: "~/Documents/Obsidian/MyVault"

# GitHub repository configuration
github:
  username: "your-github-username"
  repo: "your-repo-name"
  branch: "main"  # optional, defaults to "main"

# Path to your attachments folder (images, PDFs, etc.)
attachments_folder: "~/Documents/Obsidian/MyVault/assets"

# Output directory (your cloned GitHub repo)
output_path: "~/Documents/Projects/your-repo-name"

# Subdirectory for assets in the output repo
output_path_resources: "assets"

# Files to include (glob patterns)
include:
  - "**/*.md"

# Files to exclude (glob patterns)
exclude:
  - "**/Templates/**"
  - "**/Daily/**"
  - "**/.obsidian/**"
  - "**/Excalidraw/**"

Configuration Options

Option Required Description
vault_path Absolute path to your Obsidian vault
github.username Your GitHub username
github.repo Target repository name
github.branch Branch name (default: main)
attachments_folder Path to folder containing images/attachments
output_path Path to your local clone of the GitHub repo
output_path_resources Subdirectory for assets in output
include Glob patterns for files to include (default: **/*.md)
exclude Glob patterns for files to exclude

Usage

Sync your vault

ob-sync sync

This will:

  1. Find all markdown files matching your include/exclude patterns
  2. Transform wiki-style image links to GitHub raw URLs
  3. Copy transformed files to your output directory
  4. Copy referenced images to the assets folder
  5. Commit and push changes to GitHub

Sync without pushing

ob-sync sync --no-push

Sync with custom commit message

ob-sync sync -m "Updated notes on Docker"

Check sync status

ob-sync status

Shows:

  • Vault path and existence
  • Output path and existence
  • Git branch and status
  • GitHub repository info

Show version

ob-sync --version

Show help

ob-sync --help
ob-sync sync --help

How It Works

Wiki-Link Transformation

ob-sync automatically transforms Obsidian wiki-style image links:

Before (Obsidian):

![[my-diagram.png]]

After (GitHub-compatible):

![my-diagram](https://raw.githubusercontent.com/username/repo/main/assets/my-diagram.png)

Incremental Sync

ob-sync tracks file hashes in .sync-hashes.json to avoid re-processing unchanged files. Only modified files are transformed and copied.

Prerequisites

  • Python 3.9+
  • Git installed and configured
  • GitHub repository cloned locally (at output_path)
  • SSH keys or credentials configured for Git push

Dependencies

License

MIT

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ob_sync-0.1.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ob_sync-0.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file ob_sync-0.1.2.tar.gz.

File metadata

  • Download URL: ob_sync-0.1.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ob_sync-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8f9772f19206409ecdfc215f3551e711c99555f567484ae0e4fe2798f628c28c
MD5 6a597c9fadcfed019b90d466ba351fdf
BLAKE2b-256 a1da99464ef193b226f17ab8452be306b0176905485f41e65c9d0180923039d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ob_sync-0.1.2.tar.gz:

Publisher: publish.yml on sounak07/obsidian-transformer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ob_sync-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ob_sync-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ob_sync-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 990da6f79f0f6f9ee8509023dcfc7153206416d07dd14d1750d84b6c6112a86e
MD5 4abf3a156eeb7b857ab03c6f881f4332
BLAKE2b-256 29cb2ba0a288d23b898dfe84d1471bbee36c08ae0248023616eeb252fbe0b1fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for ob_sync-0.1.2-py3-none-any.whl:

Publisher: publish.yml on sounak07/obsidian-transformer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page