Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save notTag/4a60598d018124c9ac4a7b1f3e2bac9a to your computer and use it in GitHub Desktop.

Select an option

Save notTag/4a60598d018124c9ac4a7b1f3e2bac9a to your computer and use it in GitHub Desktop.
#---------------GitHub Pages + Namecheap Domain + SSL Cheat Sheet------------#
NOTE: You do NOT need to buy PositiveSSL from Namecheap.
GitHub Pages provides free SSL automatically via Let's Encrypt.
# Namecheap Domain Setup
Buy Domain
Go to namecheap.com, select and buy domain name.
Navigate to DNS Settings
Login to Namecheap → Username dropdown → Dashboard
Go to DomainList
Click Manage button
Click Advanced DNS tab
Add DNS Records
Click "Add Record" and add the following:
A Records (point root domain to GitHub Pages IPs)
Type: A Record | Host: @ | Value: 185.199.108.153 | TTL: Automatic
Type: A Record | Host: @ | Value: 185.199.109.153 | TTL: Automatic
Type: A Record | Host: @ | Value: 185.199.110.153 | TTL: Automatic
Type: A Record | Host: @ | Value: 185.199.111.153 | TTL: Automatic
CNAME Record (point www subdomain to your Pages site)
Type: CNAME Record | Host: www | Value: yourusername.github.io | TTL: Automatic
# GitHub Repo Setup
Add CNAME File
Add a CNAME file to the root of your GitHub repo containing only your domain name.
yourdomain.com
Configure GitHub Pages
In your GitHub repo go to Settings → Pages
Set your custom domain and save
# Enable HTTPS
Wait for DNS propagation (up to 24 hours)
Check "Enforce HTTPS" in Settings → Pages
GitHub will automatically provision a free TLS cert via Let's Encrypt once DNS resolves.
The "Enforce HTTPS" checkbox will be greyed out until this happens.
@aalavandhaann

Copy link
Copy Markdown

Thank you very much for this useful tutorial.

@hypagedev

Copy link
Copy Markdown

Thanks!

@brienna

brienna commented Jan 19, 2021

Copy link
Copy Markdown

Thank you!

@luiscolungaperez

Copy link
Copy Markdown

You're a star, thanks you

@ivanlynch

Copy link
Copy Markdown

Thanks dude!!

@chuanenlin

chuanenlin commented Feb 24, 2021

Copy link
Copy Markdown

@asadbek-fayzulloev

Copy link
Copy Markdown

Thank you!

@eduuh

eduuh commented Apr 30, 2021

Copy link
Copy Markdown

Thanks Alot

@chttrjeankr

Copy link
Copy Markdown

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
Copy Markdown

This worked! Perfect

@Saklain404

Copy link
Copy Markdown

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

nikste commented Jun 29, 2021

Copy link
Copy Markdown

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

@lucriver

Copy link
Copy Markdown

Thank you!!

@ehsong

ehsong commented Dec 20, 2021

Copy link
Copy Markdown

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

@ehsong

ehsong commented Dec 20, 2021

Copy link
Copy Markdown

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
Copy Markdown

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

@CUBICinfinity

Copy link
Copy Markdown

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

@votrepoesie

Copy link
Copy Markdown

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

@CUBICinfinity

Copy link
Copy Markdown

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

MahD121 commented Jun 18, 2023

Copy link
Copy Markdown

Merci!

@S-Barrie

Copy link
Copy Markdown

Respect... all the way.

@yessin007

Copy link
Copy Markdown

Thank You

@JoDaRober

JoDaRober commented Nov 19, 2023

Copy link
Copy Markdown

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

tngo0508 commented Dec 2, 2023

Copy link
Copy Markdown

Thank you, you're a legend.

@Alequadra

Copy link
Copy Markdown

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

@spottseng

Copy link
Copy Markdown

Thank you!

@jordanrw

jordanrw commented May 2, 2024

Copy link
Copy Markdown

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?

@Nahidh96

Copy link
Copy Markdown

Thank youu

@Pradhyumna-coding

Copy link
Copy Markdown

I have the same issue there is just a blank screen being shown nothing else except the title

@notTag

notTag commented Apr 2, 2026

Copy link
Copy Markdown
Author

After 9 years, I updated this sheet 😂 . It includes the updated IPs and updated processes for configuring your Namcheap domain with github pages. I also added a note on how to set up your page with ssl for improved security. I hope y'all have grown tremendously in your cs careers and personal tech proficiencies. See you in another 9 years?

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