This repository has been archived on 2023-07-05. You can view files and clone it, but cannot push or open issues/pull-requests.
notes/Terminal Tips/Shells/Internet/Obsidian/Obsidian-git process.md

87 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

2023-07-05 03:05:42 +00:00
Resources:
- Follow the instructions [here](https://medium.com/analytics-vidhya/how-i-put-my-mind-under-version-control-24caea37b8a5) and document as you go:
- Refer back to [plists](obsidian://open?vault=Coding%20Tips&file=Computers%2FMac%20OS%20X%2FBBEdit%2Fplist) for a better understanding of implementation and usage.
- on Cron: https://osxdaily.com/2020/04/27/fix-cron-permissions-macos-full-disk-access/
- 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.
---
#### Syncing my Obsidian: The Steps I took
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.
1. **Find your Google Drive location and copy the directory path.
```
pwd | pbcopy
```
2. Go to your **local** projects folder and `git init` there locally.
```
mkdir gitlab_sync
cd gitlab_sync
git init
git branch -m main
#renamed branch to main insted of master
#less typing xD
```
3. Then create a bare clone copy into your copied google drive location.
```
git clone --bare . ~user/Google\ Drive/My\ Drive/folder/location.git
```
4. Then go ahead and make a new remote using this git path inside your local directory.
```
git remote add NameOfRemote ~user/Google\ Drive/My\ Drive/folder/location.git
```
5. Make some changes to your git repository by adding files and commit those changes.
```
**git** add LICENSE.md
**git** commit -m 'Initial sync version'
```
6. Then I pushed the changes to the remote google drive location.
```
git push -u origin main
```
##### Pushing to Gitlab
7. Next, I added the (SSH) remote of the gitlab server to upload to as well.
```
git remote add NameofRemote git@gitblah.com:user/repo.git
```
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.
```
git add .
git commit -m "an update message here"
```
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.
13.
---
- Lastly but not leastly, I stumbled upon Perlite in my search for obsidian sync.
![[Pasted image 20230206134648.png]]
The sample view of Perlite extension.