Setting up my custom domain with GitHub Pages and Google Domains

Today I finally got my custom domain, christopherkylehorton.com, set up! This is a major milestone for my personal website. A complete noob like me didn't quite understand how to get the custom domain applied correctly at first (turns out "web forwarding" just wasn't what I wanted), but with a little bit of digging and perseverance, I eventually got it all straightened out.

I also have a subdomain, blog.christopherkylehorton.com, which goes straight to this blog.

This post is dedicated to my classmate +Cameron Beyer , who gave me the Google Domains invite in the first place.

How To Set It Up For Your Own Site

I had to look in a couple different places to get this working properly. However, it now appears to be working, so I might as well share how to do this easily. Keep in mind that these instructions are for setting up a personal website with Google Domains and GitHub Pages; I'm sure there are easier ways to get a website up and running if you don't feel like doing anything too technical, and the exact steps may differ if you are doing a project/organization page or different (sub)domain scheme.

First, get your domain from Google Domains. The price depends on the domain extension; my .com extension was priced at $12 per year.

You'll also want your personal website created at GitHub Pages. This lets you hand-code whatever you want, and do it all with Git. Put together at least something which will render in a web browser and commit it to master. Your page should now be available at something like githubusername.github.io.

To set up the custom domain, you can follow the convoluted instructions GitHub provides, which seem to assume you already kind of know how this stuff works (I didn't). I didn't find Google Domains' documentation terribly helpful for nontechnical users either, but maybe they can be excused since it's still in beta. After some looking around (and gaining some insight from this blog post on Hongkiat.com), I realized all I had to do was the following:
  1. In the top-level directory of your repository's directory, create a file simply called CNAME, containing a custom subdomain all by itself on one line. For example, mine simply reads:

    www.christopherkylehorton.com

    GitHub will redirect your top-level directory to your www. subdomain automatically, if that's what you're after, by also adding A records in the next step.
  2. In the DNS tab under your Google Domains account, scroll down to the "Custom resource records" section and add a CNAME record (for your subdomain) and a pair of A records (if your subdomain was www.).

    The current IPv4 addresses for GitHub's servers to use for the A records are, as of this writing (yes, it can change, so you need to pay attention in the future), these: 192.30.252.153 and 192.30.252.154. You're welcome! The page I got these from also recommends using dig on Linux to ensure it is set up correctly, although the changes might take up to 24 hours to propagate and take effect.
See a screenshot of my settings below for an example:
And you should be all set!

Popular posts from this blog

Fun Run 2: Tips, Tricks and Strategies

Live sample of an inheritance scam: A dissection