Domain Mapping to GitHub

A Records vs. CNAME Records

When you are mapping a domain on GitHub pages (or on any site really) an important concept you want to try and wrap your head around is the difference between A Records and CNAME Records. I’m getting closer to full comprehension, but a little help never hurts so I took the following definition from DNS Simple :

The A record points a name to a specific IP. For example, if you want to point to the server you will configure: . A

The CNAME record 4 points a name to another name, instead of an IP. The CNAME source represents an alias for the target name and inherits its entire resolution chain. Let’s take our blog as example: . CNAME .

To summarize, an A record points a name to an IP. CNAME record can point a name to another CNAME…

It’s good practice to point domains using CNAME records when possible because IP addresses can change, and when they do an A Record will break because it is hardcoded. You might think of CNAME records as relative hostnames, hence the IP address can change regularly but the mapped domain will not break.

One issue is that root domains (sometimes called “zone apex” or “naked domain”) have to be setup as an A record, not a CNAME. This means that with most DNS providers you can setup a subdomain CNAME ( to point to a service like GitHub, but you cannot setup your root domain ( ) as a CNAME. That root domain would have to be an A record. Make sense? Good.

Mapping your Domain on GitHub

As you might have guessed from the above definitions, there are two methods for mapping a custom domain on GitHub: CNAME and A Records. You can get a good overview of how Custom Domains work on GitHub here . Mapping a subdomain using a CNAME record is recommended so the domain doesn’t break if the server IP changes, which may very well happen. That said, we understand sometimes you just need that root domain mapped, so an A Record is nice and will suffice.

Mapping your Root Domain with A Records

For this example I’ll be mapping the root domain  onto a Github page. In terms of getting your Github pages setup for this see GitHub’s “Setting Up a Custom Domain with GitHub Pages .”

First you need to find the DNS Zone Editor under the Domains section in cPanel.



After that you need to choose the root domain you will be mapping. In the example screenshot below you’ll see I have several, but you may only have one which would be the default.



Once you select the domain you need to create two A Records for it using the below screenshot as a template, through the Name will obviously be different depending on the root domain you are mapping. The two a Records will point to the following IP addresses on GitHub: and You need to create a separate A Record for each of these IPs.

DNS Zone editor2

Once you have created both A Records in the Advanced DNS Zone Editor you should be all set. GitHub has their own documentation with “Tips for Configuring an A Record with Your DNS Provider ” that might also be useful. If you are having any issue see GitHub’s “My Custom Domain Isn’t Working ” or contact

Mapping your Subdomain with CNAME Records

For this example I’ll be mapping the subdomain onto a GitHub Pages Repository using a CNAME Record. Head to Advanced DNS Settings.



Once there, select the domain you will be mapping to if you have more than one.



Now you name to add a CNAME record with the subdomain you are mapping in the Name field and the URL of your GitHub account in the CNAME field.


After that you should be set. I found even if your repository is  like mine is in this instance, you only need  in the CNAME field.

GitHub provides a page with “Tips for configuring a CNAME record with your DNS provider” if you need more help, comment below or put in a support ticket.

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more
Reclaim Hosting Support Hours
8:00 am - 5:00 pm ET, Monday through Friday
Submit a Ticket
Get a quick and helpful response from the pros.
Need Extra Support?
No problem, we're here to help! Talk to us about Professional Services.