PRIVATE source repo → PUBLIC site repo
More secure way to deploy GitHub Page with repo in resource-public.
With the security concerns of exposing source Markdown files and Git history, I recently switched my previous public GitHub Pages repository to a private source repository, which will only be responsible for building and deploying to a separate public repository.
Let's check the best practices for this private-to-public deployment setup!
Practice Background
Let's take my old mkdown blog repo ytianle.github.io as an example, which was public and contained both the MkDocs source files and the generated static site. This meant that anyone could view the Markdown sources, commit history, and author information directly on GitHub.
- Public repo (old):
ytianle.github.io(public, contains both source and generated files)
Migration Target
- Private repo (old):
ytianle.github.io→ytianle.github.io_private(MkDocs source, scripts, images, raw notes, build tooling) - Public repo (new):
ytianle.github.io(public, contains generated static files only)