Syncing your obsidian to version control is probably the most efficient way to host your information locally without relying on a cloud provider for unlimited storage. View the process below to see how I got started.
My Obsidian files are all stored within Google Drive. So in order to maintain sync while still preserving cloud storage space, I used a few different steps than the guides, and well really it was a culmination of it all.
This can be done locally or via Google Drive. However, I will be using **[Linode](obsidian://open?vault=enter&file=Coding%20Tips%20(Classical)%2FTerminal%20Tips%2FGUIs%2FInternet%2FServers%2FCloud%20Servers%2FLinode)** to host [Gitea](obsidian://open?vault=enter&file=Coding%20Tips%20(Classical)%2FTerminal%20Tips%2FGUIs%2FInternet%2FRepos%2FGitea) to host my obsidian and all my repos locally.
But basically this is the self-hosted information flow: A Sketch
##### 3. Syncing Your Vault to Push every few minutes
So this is all great and all, you can now push and pull to a remote server that you own! However, it is a bit annoying to have to do the same terminal commands of git pull, add, commit, push, blah blah dsjkhfalfhk. It can get repetitive. So what do we do? We make a script that can take care of this automatically for us.
###### *For Linux:* Sync the Obsidian vault very few minutes with this script via `cron`:
So the goal here is to put a launchd .plist into that so that your Mac knows to trigger a LaunchDaemon upon a certain trigger.
2. First, however we need to make a bash script that does that syncing itself. This can be done by navigating to `~/.local/bin` and create a shell script by:
```
touch zk_sync
chmod +x zk_sync
```
*Separately:* Also make sure to copy the absolute path of your vault as that will be the environment variable that you will input into `ZK_PATH` to ensure that it still works. You can obtain the path by:
```
> pwd
#output
> /Users/shwethajayaraj/Google Drive/My Drive/RESOURCES (Research - my notebook)/collabtestdir/Notepad
```
If there are spaces in your working directory just make sure that you put in wrapped double quotation marks.
3. What are the actual contents of the shell script though that have to be done?? Well, go ahead and `vim` into the `zk_sync` file and paste the following in:
4. Now it is time to submit this to the `launchd` scheduler. Navigate to `~/Library/LaunchAgents` as this is where you will be dropping your .plist file.
8. I then created another branch for the upload sync to take place.
```
git branch AnotherBranch
git checkout AnotherBranch #switch into it
```
9.
10. Then follow the instructions [outlined on this article](https://techstreams.medium.com/git-google-drive-simple-git-host-3a84db4fc1fd). Basically you then create a git clone of it in your new directory by `git clone --bare . PATH_TO_GOOGLE_DRIVE_SYNC_FOLDER/ANY_SUBFOLDER_PATH/PROJECT_NAME.git`
11. Then do a git remote by `git remote add REMOTE_NAME PATH_TO_GOOGLE_DRIVE_SYNC_FOLDER/ANY_SUBFOLDER_PATH/PROJECT_NAME.git`
12. Add files to stage for commit and commit a message.
13. Lastly, push the changes onto your quantum programming repo.
```
git push -u origin main
```
Voila! You should see the changes now [over here](https://gitlab.com/shwetha729/quantum-programming). Or wherever you decided to set up host the git remote server on.
- Follow the instructions [here](https://medium.com/analytics-vidhya/how-i-put-my-mind-under-version-control-24caea37b8a5) and document as you go:
- on [Cron]( https://osxdaily.com/2020/04/27/fix-cron-permissions-macos-full-disk-access/):
- *UPDATE*: crontab is deprecated for MacOS so the sync option given will not work.
- the best next alternative is then to use [launchd](obsidian://open?vault=enter&file=Coding%20Tips%20(Classical)%2FTerminal%20Tips%2FShells%2FComputers%20(operating%20system)%2FApple%20Macbook%2FLaunchd) or keyboard scheduler as described through this youtube video.
- Refer back to [plists](obsidian://open?vault=Coding%20Tips&file=Computers%2FMac%20OS%20X%2FBBEdit%2Fplist) for a better understanding of implementation and usage.
- apparently the extension [Obsidian-Git](https://github.com/denolehov/obsidian-git/wiki/Installation#existing-repo) already does this in an easier way now
- So this is how you [push it to your gitlab](https://about.gitlab.com/blog/2022/03/15/publishing-obsidian-notes-with-gitlab-pages/)
- Refer to the [Git page](obsidian://open?vault=Obsidian&file=Coding%20Tips%2FComputers%2FTerminal%20Tips%2FGit) on here for more shortcuts.
- This page exists now showing o[ne way to setup gitea with Obsidian](https://webuxlab.com/en/projects/gitea-obsidian)
My perspective of your perspective is "Shway confuses the shit out of me, she doesn't want to be with me anymore. Oh she's going to India but sent me this text that clearly sounds like a breakup but she said she doesn't want to break up. I can't do these things to be that person so I'll end it with her first. Gotta move on quickly I guess, downloading all the apps. Oh she's available for me again, nice I guess we can still hook up and stuff. Time to start dating someone else. Wtf she's texting me again now, I should be cautious. Wait she disappeared there's no way she's busy (I was) she must be going to that sex party she talked about (I am way too chicken for that btw). Ehh she's inviting me to things again it's too much effort I'll wait for her to come to me. Ok I'll go to the beach & invite her and then ignore her the whole time and treat her as a friend so that she'll try harder for me. What, she basically just invited me over and let me go. I'm annoyed. And then I'll still mess around with other people too. Sweet i'm in a relationship now with someone who wants me, So what if it doesn't work out or if it's a rebound, it'll get her jealous. Oh wow she's sick of not getting a response from me? She really let me go..? Damn I got blocked. It's valid though. I'm not good enough for her anyway."
Goodbye. I really did like u but yeah theres a billion boys like you. You're better off with your new girl. truly.
I'm glad you realized this all out on your own.
You're wrong in the fact that I did get in a relationship with someone else too but I was at last honest enough to not let it last because I'm clearly still texting you.
Let me sum up my perspective of your perspective "Shway confuses me and doesn't want to be with me anymore (she did). This isn't gonna work anyway. Time to get with other people. Okay she's still texting me I guess I still have access to her, we could still hook up....wait she disappeared again. Oh she poured her heart out, let me play with that a bit because she disappeared *hits bong*(I was busy this whole summer). She must be getting with other people or going to a sex party (I am too chicken for that btw but I did date one guy after we hooked up after the beach) Damn she's texting me seems like she misses me. Let me be distant. Damn I got blocked. Damn I still gotta play around it looks like because I generally don't want to put that much effort into relationships because they won't last but i have money so I can take girls on dates. Whatever. Some other girl will come along & I'll date her. *hits bong* I don't need to put effort into Shway she deserves better anyway, it won't be from me though & she likes me anyways so I'm fine. Oh weird I got blocked. Maybe I'm not that great anyways. whatever. (Shway rejects herself constantly before you do so she blocks first) Strange. *hits bong* "
bruh. I know you. figure your life out. I don't want to be with you and I was down to be your friend. But just so you know I like playing along. Be with me after that. If I'm not already with someone else by then lmao.
get your shit straight. you need to stay with your fam and far away from me. i can't bring you near mine.