Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 86 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save notTag/4a60598d018124c9ac4a7b1f3e2bac9a to your computer and use it in GitHub Desktop.
Save notTag/4a60598d018124c9ac4a7b1f3e2bac9a to your computer and use it in GitHub Desktop.
Process for setting up github pages with namecheap domain.
1. Go to namecheap.com, select and buy domain name.
2. Login to namecheap, go to username drop down and select dashboard.
3. Go to DomainList
4. Click manage button
5. Click Advanced DNS tab
6. Click add record and add three records:
Type: A Record | Host: @ | Value: 192.30.252.153 | TTL: Automatic
Type: A Record | Host: @ | Value: 192.30.252.154 | TTL: Automatic
Type: CNAME Record | Host: www | Value: username.github.io. | TTL: Automatic
NOTE: CNAME record value must have a '.' at the end of it.
7. Click Save changes.
8. Go to github project (or make new one) and add file called CNAME. In it add the domain name you just purchased. I found that if I didn't add "www" in the beginning then I could access it through "username.github.io/projectName" which would redirect to the namecheap domain but not directly through the namecheap domain. So remember to add "www" in the beginning of the CNAME file!
8. Add an index.html to your projects root.
9. Go to project settings>Github Pages>Source and change it from none to master branch. Save.
9. Enjoy!
Helpful resources:
https://gist.github.com/mapsam/ce60b87eea561ea6bdbf
https://www.namecheap.com/support/knowledgebase/article.aspx/9645/2208/how-do-i-link-my-domain-to-github-pages
@uzbeki
Copy link

uzbeki commented Aug 15, 2020

Thank you!

@aalavandhaann
Copy link

Thank you very much for this useful tutorial.

@hypagedev
Copy link

Thanks!

@brienna
Copy link

brienna commented Jan 19, 2021

Thank you!

@luiscolungaperez
Copy link

You're a star, thanks you

@ivanlynch
Copy link

Thanks dude!!

@chuanenlin
Copy link

chuanenlin commented Feb 24, 2021

@asadbek-fayzulloev
Copy link

Thank you!

@eduuh
Copy link

eduuh commented Apr 30, 2021

Thanks Alot

@chttrjeankr
Copy link

Thanks for the easy tutorial! 🌟

Just an update:
GitHub changed the IPs to

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Refer GitHub docs

@sidco0014
Copy link

This worked! Perfect

@Saklain404
Copy link

Thanks for the easy tutorial!

Just an update:
GitHub changed the IPs to

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Refer GitHub docs

hey.. sidco014 i just add all of this things and currently i didnt acces my website on my domain name..... my domain shows blank screen

@nikste
Copy link

nikste commented Jun 29, 2021

@Saklain404, i have the same problem, did you manage to fix it?

@lucriver
Copy link

Thank you!!

@ehsong
Copy link

ehsong commented Dec 20, 2021

@nikste @Saklain404 Hi, I updated the four domains but I get a blank page as well -- did you manage to fix it?

@ehsong
Copy link

ehsong commented Dec 20, 2021

After several attempts I found out the custdom domain works for individual pages but not the first page - for instance, esthersong.org/research is accessible but esthersong.org the main page remains blank.

@yankunsong
Copy link

adding www before your own domain is pretty important! Thanks man!

@CUBICinfinity
Copy link

What about when not using www or any subdomain? Would that just be ALIAS | @ | username.github.io. ?

@votrepoesie
Copy link

Thank you so much! However I can't get it verified under the custom domain section even though it's working?

@CUBICinfinity
Copy link

What about when not using www or any subdomain? Would that just be ALIAS | @ | username.github.io. ?

I forgot I asked this question; that is correct.

@MahD121
Copy link

MahD121 commented Jun 18, 2023

Merci!

@S-Barrie
Copy link

Respect... all the way.

@yessin007
Copy link

Thank You

@JoDaRober
Copy link

JoDaRober commented Nov 19, 2023

Still works. Thank you! I've been trying to get this set up for several days now. The note to add the '.' to the end of the CNAME value is one that I didn't see anywhere else.

As others are saying, github has updated the IP addresses used for the A records. I set mine up like this.

image

At first, I did get a privacy warning (not using https) when trying to access the site via the apex domain, but not using the subdomain (www.). After waiting about 30 mins that issue resolved itself.

@tngo0508
Copy link

tngo0508 commented Dec 2, 2023

Thank you, you're a legend.

@Alequadra
Copy link

I cannot make it to enforce HTTPS, anyone can help?

@smpotts
Copy link

smpotts commented Jan 6, 2024

Thank you!

@jordanrw
Copy link

jordanrw commented May 2, 2024

I cannot make it to enforce HTTPS, anyone can help?

Somewhat similarly, I'm not able to access the website without typing in www before the domain. If I just go to the domain without anything in the front or with https:// then it won't connect.

Has anyone else had this issue?

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