Using a Custom Domain Name with GitHub Pages and Squarespace

Date Posted: 6/20/2024

For years, I've been hosting my personal website here with GitHub Pages. The domain name, as in the address you type to get here, had been left as the default fallscameron01.github.io, which, while convenient, is not exactly an easy thing for people to remember. It's definitely not something you can easily speak aloud, either. Plus, it just looked a bit unfinished.

So, I finally decided to register my own domain name. However, instead of remaking the website or attempting to self host it, I wanted to simply point my domain to this website, hosted on GitHub. The process to do so was actually a lot easier than I thought it would be.

After looking around a bit, I decided to use Squarespace for purchasing my domain, as it seemed to be a fairly straightforward process. I simply had to decide on my domain name, cameronfalls.com, and then purchase it. After that, I'm left with a blank website at my domain. Next, I had to point it to my GitHub Pages site, where my website actually lives.

GitHub provides fairly in-depth instructions for using a custom domain with your GitHub Pages repo, but I'll briefly overview it here. First, I had to tell GitHub to expect the page to be hosted at my custom domain. This is as simple as putting my domain name in the "Custom Domain" field under the repo's "Pages" settings section. Now, GitHub will look to see if the DNS is properly configured, which at this point it wasn't.

To configure the DNS resolution correctly, I needed to input some DNS records for my domain back on Squarespace. This was straightforward, as all needed to do was create 4 "A" records (for IPv4), 4 "AAAA" records (for IPv6), and a "CNAME" record. The A and AAAA records essentially resolve the IP address of the domain to GitHub's IP addresses. These addresses can be found in GitHub's documentation. The CNAME record is used for redirecting "www" prepended addresses to simply "cameronfalls.com".

Once the DNS records were created with Squarespace, it took a bit of time for the records to populate. After they did though, GitHub detected that the DNS was configured properly and began serving my GitHub pages site on my custom domain. A few links needed to be updated to use my new domain around the site, but, after that, my website looked just as it did before, now with a custom domain!