─── ❖ ── ✦ ── ❖ ───

Associated notes

This note is part of a series about how this blog is set up. See here for an overview.

Introduction

Basic Setup

1. Install Obsidian, GitHub Desktop & Git

(Reasons for chosen programs)

GitHub Desktop includes a git client, however for a number of reasons we need another separate git installation for the Obsidian git plugin. β†’ https://github.com/desktop/desktop/issues/3801#issuecomment-357713357

Git, Obsidian

2. GitHub Setup (Blog repository)

3. Initial Obsidian Settings

  • Options β†’ Appearance > Base color scheme β†’ Dark
  • Options β†’ Files and links β†’ Deleted files β†’ Move to Obsidian trash (.trash folder)
  • Options β†’ Files and links β†’ Detect all file extensions β†’ enable
  • Options β†’ Files and links β†’ Default location for new attachments β†’ in subfolder under current folder β†’ attachments
  • Options β†’ Files and links β†’ Default location for new notes β†’ In the folder specified below β†’ private
  • Options β†’ Editor β†’ Default editing mode β†’ Source mode
  • Options β†’ Editor β†’ Display β†’ Readable line length β†’ toggle off
  • Options β†’ Editor β†’ Behavior β†’ Spellcheck languages β†’ Add English

Create required folder structure

Minimal setup:

C:\users\USERNAME\Obsidian\VAULTNAME\
 β”œβ”€β”€ .obsidian
 β”‚   └── ...
 β”œβ”€β”€ .github
 β”‚   β”œβ”€β”€ sync.yml
 β”‚   └── workflows
 β”‚       └── sync.yml
 β”œβ”€β”€ private
 β”‚   └── .gitkeep
 └── public
 β”‚   └── index.md
 └── .gitignore

Contents of /.github/workflows/sync.yml and /.github/sync.yml:

zoylendt/zoylendt.github.io@v4:
  - source: public/
    dest: content/
    deleteOrphaned: true
name: Sync Files
on:
  push:
    branches:
      - main
  workflow_dispatch:
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@master
      - name: Run GitHub File Sync
        uses: BetaHuhn/repo-file-sync-action@v1
        with:
          GH_PAT: ${{ secrets.GH_PAT }}
          SKIP_PR: true

The file .gitignore contains only one line:

.obsidian/workspace.json

(Explain .github files etc, original file add .gitignore retroactively)

  • β€œSKIP_PR: true” β†’ pushes directly to default branch, skips creating a pull request
  • β€œCOMMIT_EACH_FILE: false” β†’ commit multiple file changes a a single commit
  • β€œmain” instead of β€œmaster”

(Optional) Suggested folder structure:

C:\users\USERNAME\Obsidian\VAULTNAME\
 β”œβ”€β”€ .git
 β”‚   └── ...
 β”œβ”€β”€ .obsidian
 β”‚   └── ...
 β”œβ”€β”€ .github
 β”‚   β”œβ”€β”€ sync.yml
 β”‚   └── workflows
 β”‚       └── sync.yml
 β”œβ”€β”€ .trash
 β”‚   └── .gitkeep
 β”œβ”€β”€ private
 β”‚   └── .gitkeep
 └── public
 β”‚   β”œβ”€β”€ index.md
 β”‚   β”œβ”€β”€ template.md
 β”‚   β”œβ”€β”€ tags
 β”‚   β”‚   └── tag1.md
 β”‚   β”œβ”€β”€ Topic1
 β”‚   β”‚   β”œβ”€β”€ blogpage1.md
 β”‚   β”‚   └── attachments
 β”‚   β”‚       └── image.png
 β”‚   └── Topic2
 β”‚       └── blogpage2.md
 └── .gitignore

(Reasons for this structure)

Initialize Obsidian folder as git repo (using GitHub Desktop)

Now we need to initialize the Obsidian vault directory as a git repo. Using GitHub Desktop this works as follows:

  • (Install GitHubDesktop and log in with your GitHub USERNAME)
  • GitHub Desktop β†’ β€œAdd an Existing Repository from your local drive” β†’ choose Obsidian folder β†’ Click on blue β€œcreate a repository” within red warning text
    • Name: obsidian-backup
    • other settings unchanged
    • Path: (path of your Obsidian vault, named VAULTNAME)
  • β†’ β€œCreate repository”
  • β†’ click the blue button β€œPublish repository”
    • β†’ name: obsidian-backup
    • β†’ β€œ[x] Keep this code private” ← IMPORTANT! GitHub Desktop can be closed now. It’s useful for resolving git issues if they occur.

Create PAT (Personal Access Token) and store it as a Repository Secret in your obsidian-backup-repo

  1. https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic

    Note: custom name, e.g. β€œsync contents to blog” Expiration: No expiration Scope: full repo scope (see image: https://github.com/BetaHuhn/repo-file-sync-action/discussions/31 )

Take note of the generated PAT for the next step! It looks like this: ghp_xxxxxxxxxxxxxxxx

https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository

Open your private obsidian-backup repo on gitHub
Settings -> Security -> Secrets and variables -> Actions-> Secrets -> New repository secret

Name: GH_PAT Secret: (PAT generated in the previous step)

(Maybe better: use GH_INSTALLATION_TOKEN as described here: https://github.com/marketplace/actions/repo-file-sync-action#token )

Obsidian Git Plugin

After making sure that we’ve installed Git and prepared the Obsidian vault as a git repo (with GitHub Desktop), we need to install and enable the Obsidian Git plugin:

  • Options β†’ Community Plugins β†’ Turn on community plugins β†’ Browse β†’ β€œGit by Vinzent, (Denis Olehov)” β†’ Install
  • Options β†’ Community Plugins β†’ Installed Plugins β†’ Git β†’ enable (slide to right)
  • Options β†’ Community Plugins β†’ Installed Plugins β†’ Git β†’ Options (kog)

…

  • Backup β†’ β€œPull updates on startup” β†’ enable
  • Commit message β†’ β€œ{{hostname}} placeholder replacement” β†’ enter your hostname
  • Commit message β†’ β€œCommit message on manual backup/commit” β†’ β€œmanual backup: {{date}} from {{hostname}}, {{numFiles}} files”
  • Automatic β†’ β€œCommit message on auto backup/commit” β†’ β€œauto backup: {{date}} from {{hostname}}, {{numFiles}} files”
  • Miscellaneous β†’ β€œShow the count of modified files in the status bar” β†’ enable
  • Commit message β†’ β€œList filenames affected by commit in the commit body” β†’ enable
  • Automatic β†’ β€œVault backup interval (minutes)” β†’ 10
  • Automatic β†’ β€œAuto pull interval (minutes)” β†’ 9

…

Customize you Quartz

config changes

  • changes of layout
  • make fat text stand out more

inspired by showcases

Working on multiple PCs

…

(add .obsidian/workspace.json) to local .gitignore) ← done

Setup on new PC (Windows)

β†’ see obsidian on multiple pc

─── ❖ ── ✦ ── ❖ ───