DEV Community

Cover image for Free Obsidian PC Android sync
Matthias Schäfer
Matthias Schäfer

Posted on

4 1 1

Free Obsidian PC Android sync

Obsidian is a great tool for collecting ideas.

I use it mainly for the following reasons:

  • Research
  • Collecting information
  • Saving some spontaneous ideas

Depending on my actual situation I prefer to use my laptop or my phone.
To always have access to my vaults, regardless of the device I am using, I need to sync the data between my devices. For that purpose Obsidian provides the Sync Plugin. But for this plugin they charge you 4$ a month, which I don't want to spend, if there is another option.

I found a solution which meets my requirements:

  • Crossplatform availability: Linux, Windows and Android
  • No manual work: no downloads, no copies, no nothing
  • free to use

What I use now:

  • Syncthing-fork on my android phone
  • Syncthing on my windows and linux machine
  • Shell script to backup the data in a git repository

Setup:

  • Install syncthing on the devices you want to use Obsidian
  • Create folders on every device to store the Obsidian files locally
  • Linking the devices using the QR code
  • Share the folders (also using QR code)
  • Copy your vault into the new directory and open it in Obsidian
  • optional:
    • create a git repository in your Obsidian directory and backup the files to your github account

Obsidian Git autobackup

#!/bin/bash

git-autopush() {
  REPO_DIR = $1
  cd "$REPO_DIR" || {
    echo "Repository not found: $REPO_DIR"
    exit 1
  }

  # Check if the repository has changes
  if [[ -n $(git status --porcelain) ]]; then
    git add .
    git status

    TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
    git commit -m "Auto-commit: $TIMESTAMP"

    git push origin "$(git rev-parse --abbrev-ref HEAD)" || {
      echo "Failed to push changes."
      exit 1
    }

    echo "Changes pushed successfully."
  else
    # Check if there are committed changes to push
    LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD)
    if [[ -n $(git rev-list origin/"$LOCAL_BRANCH"..HEAD) ]]; then

      # Push changes
      git push origin "$LOCAL_BRANCH" || {
        echo "Failed to push changes."
        exit 1
      }
      echo "Changes pushed successfully."
    fi

  fi
}

git-autopush $1
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay