Use this if your site already lives on GitHub Pages and you just want HTTPS + a custom domain.
Target result
1
In the repo, go to Settings → Pages, add a custom domain like www.example.com.
2
At your DNS provider, add CNAME www → <user>.github.io.
3
Wait for DNS propagation, then enable “Enforce HTTPS” in Settings → Pages.
4
Optional: redirect apex with a lightweight Caddyfile on a VPS:
# /etc/caddy/Caddyfile
example.com {
redir https://www.example.com{uri}
}