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.
@MahD121
Copy link
Copy Markdown

MahD121 commented Jun 18, 2023

Merci!

@S-Barrie
Copy link
Copy Markdown

Respect... all the way.

@yessin007
Copy link
Copy Markdown

Thank You

@JoDaRober
Copy link
Copy Markdown

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

tngo0508 commented Dec 2, 2023

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

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?

@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
Copy link
Copy Markdown
Author

notTag commented Apr 2, 2026

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