Using Git on Obsidian Sync vaults

I’ve tried to search this and only find answers about one or the other.

I’m a happy user of Obsidian Sync. I want to know if it’s also safe to create a Git repo from my vault and occasionally commit and push to Github, BitBucket, etc. as a backup? I intend to do so only when Obsidian is closed, and I don’t intend to use Obsidian Git. Will this create any problems? Anything I should be aware of?

1 Like

It is generally not recommended to have anybody mess in a git folder, and syncing solutions do exactly that. But it is possible to sore the actual git folder somewhere else, and in the Obsidian vault only store a .git file:

(These are my settings: ~/Archive/SecondTimeGit as git folder, and /Users/qwxlea/Archive/SecondTimeGit is the full path, change according to your local setup)

From your vault’s root:

git init --separate-git-dir ~/Archive/SecondTimeGit

This is the same as regular git init, but it stores the actual git directory somewhere else

Install de git plugin for Obsidian

Additional environment variables (use complete path, or relative path, “~” doesn’t work):

GIT_DIR=/Users/qwxlea/Archive/SecondTimeGit

That should be all that is needed to have both git as Obsidian sync

2 Likes

Wow, now that is interesting. Git is the gift that keeps on giving! Thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.