Migrating My Obsidian Vault From iCloud to Git

I have been using Obsidian for note-taking for quite some time now, having switched from Logseq. Both are quite similar in functionality to me, but I much prefer Obsidian’s “File over app” approach. In case the product get discontinued, I still get to keep my notes because, in the end, they are .md files.

I use iCloud to back up my Obsidian notes and i has worked very well so far. Never encounter any out-of-sync issue but now since I can’t use iCloud on my work machine, I need a new alternative. I considered paying for Obsidian Sync, but I already have too many subscriptions. So, a Git-based setup it is.

The migrations process are seamless. Here are the steps I took to migrate my Obsidian Vault to Git:

  1. Copy Obsidian folder
    Copy my Obsidian folder to ~/Developer/obsidian , out of iCloud folder.
  2. Initialize local & remote git repository
    Initialized git repository in my local vault. Then, I created a remote repository on Github and added it as origin.
    > cd ~/Developer/obsidian  
    > git init~  
    > git remote add origin git@github.com:username/repo.git`
  3. Configure .gitignore
    Added .gitignore to exclude unnecessary files. While some suggest to ignore the .obsidian folder, I included it so that my configurations and plugins are synchronized across devices. I also ignore work/ folder to exclude any sensitive info.
  4. Commit and push
    > git commit -am "Initial commit"  
    > git push -u origin main`
  5. Install git plugin in Obsidian
    Obsidian git plugin
  6. Configure the plugin
    I set the Vault Backup interval to 60 minutes (might change in the future), set the sync method as Merge and to automatically pull updates on startup.
  7. Clone the repo on work machine
    Once done, I cloned the repo on my work machine, copied over any existing notes I had on my work machine and deleted the old vault.

This setup has been working well for me for a few weeks. Hopefully, I will never encounter any issues.