How to point a domain on Google Domains to GitHub pages
Table of Contents
When setting up my website on Google Domains I had to read through several different guides to figure out all I needed to do to point it to a GitHub pages repository. I wrote up this guide to simplify the processes for anyone else performing this same task.
Navigate to https://github.com/new and create a repository with the name USERNAME.github.com or USERNAME.github.io and give it a nice description.
In your new repository, create a CNAME file in the root directory and add the following two entries (with curtismlarson replaced by your own domain):
These two entries tell GitHub to redirect any requests to USERNAME.github.io to the domain specified in the CNAME file. There are two entries to ensure that curtismlarson.com will also redirect to www.curtismlarson.com. If you prefer to have a site without the www prefix, you can switch the order of the domains.
Now verify that your USERNAME.github.io domain is now pointing to your custom domain by going into the repository settings and verifying your GitHub Pages settings:
Configure Google Domains
Navigate to https://domains.google.com/registrar and select the DNS option to configure your DNS records.
Scroll to the very bottom of the page and add 3 Custom Resource Records. You need to add two “@” type A records that point to the GitHub ips 126.96.36.199 and 188.8.131.52 and one “www” CNAME record that points to your USERNAME.github.io url:
That’s it! DNS records often take more than a day to propagate so you may not see your website immediately. Once the changes have propagated your GitHub page and any project pages should be accessible from your new domain. For example https://github.com/quackware/blog is hosting the blog you are reading right now and the domain works without any additional setup.
Curtis Larson is a NYC based freelance software developer. Follow him on Twitter or send him an email if you're looking for a talented developer.