Tip

A example workflow to add submodule in a git repo.

Reference: https://quartz.jzhao.xyz/setting-up-your-GitHub-repository

First, you should have already git cloned the quartz repo to your local, and you should have done some basic configurations.

First, make sure you have quartz cloned and setup locally.

Secondly, you should have created a private repo on github.com, likely named as ‘#quartz’.

Then, create a new repository on GitHub.com. Do not initialize the new repository with README, license, or gitignore files.

Then, update the ‘remote’ configs for your git repo (this is for future updates)

 
git remote set-url origin git@github.com:your-name/quartz.git
 
git remote add upstream https://github.com/jackyzha0/quartz.git
 
# Assume you already have changes committed to 'main' branch
git push --set-upstream origin main

If the ‘foam vault’ repo gets updated, you can pull the changes by this command (will update all submodules. )

git submodule update --remote

The command above will update your work tree with new content from the submodule’s remote branch (default ‘main’ or ‘master’).

Note

This command does not mention --rebase or --merge options becaause we assume you don’t make change on submodules (i.e. Foam Vault repo) in downstream repo (i.e. quartz repo here).

Then you just need to git add and git commit and git push to update your Quartz repo as normal.

deploy-quartz-site-with-foam-vault-as-submodule-to-github-pages

I probably want to switch to the other way around. I.e. checkout Quartz repo to my Foam repo and build the Quartz site there.

Cloudflare workers/pages does not support recurisvely checking out private submodules even if you’ve granted Cloudflare the accesses to both repos.

Github pages works, but you will need to create multiple PATs (personal access token) to chain the repo updae events (so when Foam repo is updated, Quartz repo will be updated, and then Quartz site is deployed. We need at least one PAT to pipe the event and at least PAT to checkout the Foam repo as submodule in the Quartz side.)

However, since the Quartz repo will likely be public, we should be able to checkout it in the Foam repo and build the site there.

Doing so means:

  • We probably won’t need to use any PATs.
  • We can deploy through cloudflare workers/pages instead of github pages. Then we can avoid the quartzgithub-page-tag-bug.