Skip to content

Instantly share code, notes, and snippets.

Last active December 6, 2023 21:42
  • Star 61 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
GitHub Pages with Namecheap custom domain

Using GitHub Pages with a custom domain: Namecheap Edition

As often happens, I found the official documentation and forum answers to be "close, but no cigar", and so had to experiment a little to get things working.

The main problem for me was a lack of concrete configuration examples. That's not entirely GitHub's fault: having migrated from Google Domains to Namecheap in the middle of this project, I was once again reminded of how many different ways there are to do things in the name service universe [1].

Although you'd think the simplest setup would be to merely configure for the subdomain case (, in my experience using the apex domain ( instead resulted in fewer complications.


So here's my recipe for using a custom domain with GitHub pages where Namecheap is the DNS provider:

  1. Create A records for apex domain in Namecheap Advanced DNS panel for the domain(in this example, the fictional ""):
Record Type Host Address TTL
A Record @ 30 minutes
A Record @ 30 minutes
A Record @ 30 minutes
A Record @ 30 minutes
CNAME Record www 30 minutes
  1. Wait an hour, then test if DNS is set up properly:
me@myhost:~$ dig +noall +answer +nocmd		1800	IN	A		1800	IN	A		1800	IN	A		1800	IN	A
me@myhost:~$ dig +noall +answer +nocmd	1800	IN	CNAME	3600	IN	A	3600	IN	A	3600	IN	A	3600	IN	A
  1. In the GitHub repo config for Pages (Settings... Pages), enter your apex domain, "" (not "") in the "Custom Domain" box.

  2. Wait for GitHub to generate ahd install the SSL certificate for that apex domain (at least an hour).

  3. Test by going to "" and "".

I highly recommend not changing domain registrars and DNS providers in the middle of all that.


[1] The other problem is how damned long it takes for things to propagate across global DNS, especially when starting with TTLs of an hour (the trick is to try reducing your TTL before making any other changes, going from an hour to fifteen minutes can make a huge difference in blood pressure readings). Even with shorter TTLs, you need to anticipate upwards of an hour delay between changes. So chill. Read a book. Talk to the dog.

Further Reading

"Configuring a custom domain for your GitHub Pages site". GitHub Docs,, Retrieved 9 September 2021.

"How do I link my domain to GitHub Pages". Namecheap Knowledgebase,, Retrieved 10 September 2021.

Copy link

Thanks for the tutorial, helped me to get the website running within couple of minutes without any hiccups!

Copy link


Copy link

hwedi commented Dec 26, 2022

any idea how to configure a subdomain? really appreciated

Copy link

Thank you so much!

Copy link

Thanks. This helped me alot. 👌🏿

Copy link

Verify domain, Create TXT record with:
Host: "_github-pages-challenge-ORGANIZATION" or "_github-pages-challenge-YOURUSERNAME"

Read more detail:

Copy link

Hey, thanks! This was super helpful. The GitHub documentation could benefit from your input.

Copy link

Huge thanks for this very clear step by step instruction.

Copy link

ghost commented Jul 28, 2023

Thank you, this worked for my organisation's domain name too! 🚀🚀✅

Copy link

I only realised from this that I have to use * instead of the domain that my pages use. Thank you!

Copy link

Thanks! :)

Copy link

I only realised from this that I have to use * instead of the domain that my pages use. Thank you!

can i ask what you mean by this? will this work instead? im having a lot of problems doing this process as a full beginner with my very first custom domain.

Copy link

JohnCuadrado commented Sep 16, 2023

Setting up custom domains with GitHub Pages can be tricky. Your experience highlights the need for clearer documentation. Using the apex domain often simplifies things. Feel free to ask for help. In a world where assignment help websites are constantly evolving, the Rafal Reyzer 2023 guide is like a lighthouse for students, you will find the best assignment help websites and Not only does this in-depth article shine a light on the ever-evolving world of academic support, but it also makes it easier for students to choose reliable resources. Rafal Reyzer’s cutting-edge recommendations equip you with the knowledge you need for academic success. Explore the wealth of insights that Rafal Reyzer has to offer and improve your academic life in 2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment