Credit goes to this Stack Overflow answer, but note, not the accepted answer it’s the one currently below.
Create an extra repository for your domain. I used the name of the domain as the repository name. See https://GitHub.com/johncosta/johnmcostaiii.net.
Create an index.html file in the root of the project.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Redirecting to https://johnmcostaiii.com</title> <meta http-equiv="refresh" content="0; URL=https://johnmcostaiii.com"> </head> <link rel="canonical" href="https://johnmcostaiii.com"> </html>
- Create a CNAME file in the root of the project.
- Setup the DNS for the domain to point to the GitHub pages servers. See this write up for how it should look: https://johnmcostaiii.com/posts/2023-11-10-new-blog-hosting/