To learn from giants, I forked @adityatelange’s PaperMod instead of pulling the theme directly from his repo with a submodule. This change required me to modify the Github Actions workflow yaml to accommodate for this change because I realized that the Hugo site fails to build at the step when Github Actions is trying to initialize the forked submodule of PaperMod.
This is the error:
Run git submodule update --init --recursive
Submodule 'themes/PaperMod' (git@github.com:anthropikos/hugo-PaperMod.git) registered for path 'themes/PaperMod'
Cloning into '/home/runner/work/anthropikos.github.io/anthropikos.github.io/themes/PaperMod'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:anthropikos/hugo-PaperMod.git' into submodule path '/home/runner/work/anthropikos.github.io/anthropikos.github.io/themes/PaperMod' failed
Failed to clone 'themes/PaperMod'. Retry scheduled
Cloning into '/home/runner/work/anthropikos.github.io/anthropikos.github.io/themes/PaperMod'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:anthropikos/hugo-PaperMod.git' into submodule path '/home/runner/work/anthropikos.github.io/anthropikos.github.io/themes/PaperMod' failed
Failed to clone 'themes/PaperMod' a second time, aborting
Error: Process completed with exit code 1.
I noticed the ssh
and realized that the previous successful build when I had @adityatelange’s PaperMod as a submodule, instead of my forked repo, used https
instead! Here is the last successful build.
Run git submodule update --init --recursive
Submodule 'themes/PaperMod' (https://github.com/adityatelange/hugo-PaperMod.git) registered for path 'themes/PaperMod'
Cloning into '/home/runner/work/anthropikos.github.io/anthropikos.github.io/themes/PaperMod'...
Submodule path 'themes/PaperMod': checked out '5a4651783fa9159123d947bd3511b355146d4797'
Thus, I tried adding the forked repo as a submodule using https
instead of ssh
, and it worked (the build)!
Run git submodule update --init --recursive
Submodule 'themes/PaperMod' (https://github.com/anthropikos/hugo-PaperMod.git) registered for path 'themes/PaperMod'
Cloning into '/home/runner/work/anthropikos.github.io/anthropikos.github.io/themes/PaperMod'...
Submodule path 'themes/PaperMod': checked out '0ab1ddb54ff5203d34c6a8d72bb6106e74a8fee0'
But, this problem continued to gnaw on me as I went to sleep because I was trying to avoid using https
(okay, more like I was trying to just use only ssh
).
So, I tried changing it to an ssh
link, and the build fails again.
I even tried just prepend ssh://
to the link and the build continues to fail.
Before I start tweaking this line of @adityatelange’s code, I decided to skim through the Github Actions Checkout V4 just to see if there is any more elegant solutions, and tada there is a submodules
option to adjust (ref). Thank you brilliant engineers at Github!
I simply added submodules: recursive
and commented out the previously problematic section, problem solved!
Lesson learned: Read the documentation or manual, often there is a more elegant solution than me wacking my head against the keyboard.