Skip to content

Setting the DNS for GitHub Pages on Namecheap

David Ensinger

After pushing my site to GitHub and verifying that it worked at, I then went to set up my custom domain name. The documentation provided by GitHub is clear on the subject, but I still managed to forget about my subdomains. For more than eight hours, anyone who attempted to visit was served with a 404, which is rather embarrassing for one who makes a living as a developer.

In the interest of helping others avoid the mistakes I made, here’s a guide to setting up the DNS for GitHub pages on Namecheap, my registrar of choice.

Please Note: I no longer use Namecheap to host the DNS for this site. See my new setup at Transferring the DNS from Namecheap to CloudFlare for GitHub Pages.

This guide was most recently updated with new settings to support Faster, More Awesome GitHub Pages.

Namecheap DNS doesn’t support an ALIAS record for the APEX domain, so you’ll need to use two A records for our DNS, per the instructions in the Using a custom domain with GitHub Pages. This will not allow you to use the content delivery network, but will still help protect your site against denial of service attacks.

Add a CNAME File to your Repo

Create a new file and put your domain name in it. Save it as CNAME and commit it to your GitHub repo.

Find your Host Records

Log into your Namecheap account and navigate yourself over to your Domain List, which you can find in your Dashboard. Find the desired domain name from your Domain List, and then hover over the small house icon to reveal the Advanced DNS option. Click it!

Namecheap Advanced DNS

Alternatively, you could also click the Manage button and then navigate to the Advanced DNS tab.

Set up the DNS

You’ll need to set up three different records:

  1. Click the Add New Record button and then select A Record from the list. You’ll then want to enter @ for Host and for IP Address. Leave the TTL as Automatic (use this setting for all three records).
  2. Add another new A Record with the same @ for the Host, but use for the IP Address.
  3. Finally, add another new record, but select CNAME Record. For Host set www and for the IP Address use your (with trailing period).

GitHub Pages DNS settings at Namecheap

Save and then you’re all set! Please note, however that it may take some time for the changes to the DNS to propagate.

More Info: Google has a pretty good Basic Guide to DNS.