Bought cyberoddy.com yesterday. Set up GitHub Pages today. Somewhere in between, I learned what A records actually do and why the @ symbol isn't just for email addresses.
Here's what nobody tells you when you're setting up a custom domain for the first time.
The @ Symbol Mystery
First confusion: what the heck is @ in DNS settings? Turns out it's shorthand for your root domain. When you put @ as the host, you're saying "this rule applies to cyberoddy.com itself, not www.cyberoddy.com or blog.cyberoddy.com."
So these A records:
Type: A
Host: @
Value: 185.199.108.153
Mean: "When someone types cyberoddy.com, send them to this IP address." That's it. The @ is just DNS notation for "the naked domain."
A Records vs CNAME Records
A records map domains to IP addresses. Simple. You're telling DNS "here's the actual server location."
CNAME records are aliases. Instead of pointing to an IP, they point to another domain name. My setup:
Type: CNAME
Host: www
Value: roddyg01.github.io
Translation: "When someone types www.cyberoddy.com, redirect them to roddyg01.github.io, and let GitHub handle it from there."
You can't use a CNAME for the root domain (@) -- that's why you need A records pointing to GitHub's IPs for the naked domain, then a CNAME for the www subdomain.
Why Four A Records?
GitHub gives you four IP addresses:
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
It's redundancy. If one server goes down, the others handle traffic. You add all four as separate A records with the same host (@). DNS will route to whichever one responds fastest.
The TXT Record for Verification
GitHub makes you add a TXT record to verify you actually own the domain. It looks like this:
Type: TXT
Host: _github-pages-challenge-roddyg01
Value: [some long hash]
This is just proof of ownership. GitHub checks if you can add records to the domain's DNS. Once verified, you can delete it -- though leaving it doesn't hurt.
DNS Propagation Is a Waiting Game
Changed your DNS records? Cool. Now wait. Propagation takes anywhere from 15 minutes to 48 hours, but usually under an hour.
You can check propagation with dig yourdomain.com or online tools like whatsmydns.net. If it's not working immediately, that's normal. Go touch grass, come back later.
SSL/HTTPS Is Automatic (Don't Pay for It)
GitHub Pages gives you free SSL through Let's Encrypt. Once your domain propagates, go to repo Settings → Pages → check "Enforce HTTPS." Done.
Your registrar will try to upsell you on SSL certificates. Ignore it. You don't need it for GitHub Pages.
What I Wish I Knew Before Starting
Documentation assumes you already know what DNS does. No tutorial explained that @ is just shorthand, or why you need both A records and a CNAME, or that four A records isn't a typo.
The actual setup takes 10 minutes. Figuring out what the setup actually means took three hours and a lot of tab switching between Stack Overflow and GitHub docs.
Now it's written down. Next time I do this, or you do this, it'll take 10 minutes total.