Using Gitdesktop + Github + ObsidianGit to backup vaults

Howdy! I just recently started using Obsidian after switching from ROAM research and one problem I wanted to solve immediately was backing up my files! With a lot of help from the community, particularly @foreveryone on the discord community, I managed to get Obsidian Git working. It took me probably 2 hours of troubleshooting and a lot of sadness, but hopefully having something like this on the forums will make it easier for other people who are swapping to Obsidian.

What you’ll need upfront!:

  1. Git Desktop
  2. GitHub (by this I mean make a GitHub account)
  3. Obsidian (duh lol)
  4. The Obsidian Git Plugin!
  5. Git (Go to the website and download it)

Downloading the Obsidian Git plugin workflow (assuming you already have a vault)

  1. Open your obsidian vault
  2. Go to the cogwheel on the bottom left of the screen that says settings and click on it
  3. Select the community plugins option.
  4. Turn safe mode off
  5. Browse community plugins and search for Obsidian Git by Denis Olehov
  6. Install Obsidian Git
  7. Go back to the community plugins tab and enable obsidian git.
  8. Select Obsidian Git from the plugin options
  9. Enable Pull updates on startup
    10.** Disable the “disable push” option (haha double negative)** CRUCIAL.

The next step is the hardest and it involves creating a new GitHub repository and connecting that GitHub repository to your local vault! Make sure you already made a GitHub account before this step. your credentials are important

Connecting Github Repository to Local Obsidian Vault

1. Download Git Desktop. (This will be used to connect your local vault to the online GitHub repository)

  1. The first git desktop screen you see will prompt you to “sign in to GitHub.com.” Sign in and use your git hub info

    1. If you’re already logged into Github it will open it in a browser and just ask you for your password
    2. If you sign in correctly you’ll be asked to authorize the desktop/laptop you’re on and Git desktop will then reopen
    3. It will also give you a choice of email to use (either a personal one you use when you made the online GitHub account or an autogenerated one). Either is fine.
  2. This next step is about creating a repository on GitHub and connecting it to git desktop

    1. First step is to go back to github.com
    2. Create a new private repository and name it whatever you want
    3. Make sure you don’t select any of the options to initialize the repository. Not even the readme file.
    4. Click the green button that says create a repository
    5. You’ll see 4 options for creating a repository. Click the “set up in desktop” option.
    6. Git desktop will open up and you can then click the blue “clone” button.
    7. Now you have made an empty repository on GitHub! HALFWAY THERE WOOHOO!!!
  3. **This last step is about pointing your git desktop repository to your local Obsidian vault! **

    1. From git desktop click on the “show in explorer” button in your empty repository.
    2. This should open up the location of the git repo on your local device! We want to move some files from this folder to your obsidian folder!
    3. Go to the “view” option near the top left of your file explorer
    4. Select “options” (should be the furthest right of all your choices in the view box)
    5. From “options” click on the “view tab”
    6. Turn the “hidden files and folders” option to “show hidden files, folders, and drives” and select ok.
    7. You should now be able to see the previously hidden .git folder in your local repo!
    8. Copy this .git folder to your local obsidian vault. It is fine to have the .git folder in both places. This is super important because it is what allows the Obsidian Git extension to do its job.
  4. Now that you have your .git metadata in your Obsidian vault you can go to obsidian, open up the command palette with (Ctrl + P) and type in Obsidian Git.

    1. You should then click on the “Commit all changes and push to remote repository” option.
    2. You should get a prompt from the Obsidian Git plugin in Obsidian letting you know that your files within the local obsidian vault are being transferred to your remote repository
  5. Final step is to check your GitHub repo and see if it has updated!
    Once again, a huge thanks to the Obsidian discord and @foreveryone for helping me with this workflow! If you have any questions feel free to ping me on the discord and I’ll do my best to help you!

10 Likes

This is by far the most detailed guide on this topic. Thank you for your efforts.

1 Like

Thank for your guide !

Did you achieve to sync obsidian config ?

Yep! I got it syncing with obsidian git. And the functionality was maintained even after moving my vault folder from my downloads to my desktop! Ah you meant the configurations. Yeah those were synced too. It syncs everything within the vault from plugins to shortcuts. I would recommend changing the obsidian git commit command to like ctrl + shift + s so you can do it manually with ease.

I will retry but I had some sync conflits between two windows computer with obsidian config files.

I don’t know if it was here in the forum or over at discord but someone did mention to add .obsidian and .thrash to gitignore.

Putting .obsidian in your .gitignore will not sync your settings and workspaces, but if you don’t want your settings to sync, it’s fine to put .obsidian in your .gitignore.

This is where I get lost:

Where do I enable “pull updates on startup”? Where do I disable the disable push option? I don’t see it anywhere in my settings.

When you go into settings, you should see “Obsidian Git” under “Plugin Options” on the left. If you click on “Obsidian Git,” you should be able to tinker with the settings you are referring to.

AH that’s the problem. I don’t see Obsidian Git under Plugin Options. I installed it from within Obsidian; perhaps a manual installation is called for?

1 Like

I reinstalled it, and all is well. Thanks, @JonathanBuchh!

1 Like

No problem @skeskali. Sometimes you have to restart the app to see the settings for a new plugin (I’ve only had to do it for Obsidian Git).

For le the settings appeared only when my vault had github files in it.

Ok so I had an error for obsidian config files again.

Basically, sync with github between two windows computer.

Here the error :

Uncaught (in promise) Error: From https://github.com/####/Zettelkasten
18bf750..b352192  main       -> origin/main
error: Your local changes to the following files would be overwritten by merge:
.obsidian/workspace
Please commit your changes or stash them before you merge.
Aborting

at GitExecutorChain.onFatalException (eval at <anonymous> (app.js:1), <anonymous>:2302:85)
at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:2293:28)
at Generator.throw (<anonymous>)
at rejected (eval at <anonymous> (app.js:1), <anonymous>:2247:65)

I had the problem:

11index.html:2302 Uncaught (in promise) Error: Error: spawn git ENOENT
   at Process.ChildProcess._handle.onexit (internal/child_process.js:267)
   at onErrorNT (internal/child_process.js:469)
   at processTicksAndRejections (internal/process/task_queues.js:84)
   at GitExecutorChain.onFatalException (eval at <anonymous> (app.js:1), <anonymous>:2302:85)
   at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:2293:28)
   at Generator.throw (<anonymous>)
   at rejected (eval at <anonymous> (app.js:1), <anonymous>:2247:65)
DevTools failed to load SourceMap: Could not parse content for app://obsidian.md/main.js.map: Unexpected end of JSON input

and

VM392:131 Uncaught (in promise) Error: Error: spawn git ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267)
    at onErrorNT (internal/child_process.js:469)
    at processTicksAndRejections (internal/process/task_queues.js:84)
    at GitExecutorChain.onFatalException (eval at <anonymous> (app.js:1), <anonymous>:2302:85)
    at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:2293:28)
    at Generator.throw (<anonymous>)
    at rejected (eval at <anonymous> (app.js:1), <anonymous>:2247:65)

After installing Git client.
And input the environment variables to System path
Then the plugin work ok.

Already did both :confused: thanks !

Did you restart your computer after these 2 steps?

Yes still have workspace sync issue after reboot.

Then i dont know…

So you have obsidian git, git client, and the git hub repository set up but you’re experiencing conflicts when pushing changes from your local vault to your remote repository? I may need to update the initial forum post to add the .gitignore file. What does your remote repository look like on Github right now? Is it possible to display an image of that in this thread?