Connect GitHub Pages to Your Namecheap Domain
This tutorial explains how to connect a custom domain registered with Namecheap to a GitHub Pages repository in GitHub.
Contents
- GitHub Pages Setup
- Namecheap Setup
1. GitHub Pages Setup
If you've not yet created a repository for your site, log in to your GitHub account and create a new repository. Name the repository <user-name>.github.io
– for example, pauljwil.github.io
.
If you already have your HTML, CSS, and JavaScript files prepared, push them to your repository and visit your site at <user-name>.github.io
.
From your GitHub repository, click on Settings and scroll down to the second-to-last section called Github Pages. In the Custom Domain box, enter the domain you registered with Namecheap, and click Save.
Note that when you return to your repository's Code tab, a new file will have been created called CNAME
. This file will include one line of code with the domain you added in the previous step – for example, pauljwil.com
.
2. Namecheap Setup
If you've not yet registered your domain with Namecheap, do that now.
Once you've registered your domain, navigate to the Domain List and click on Manage to the far right of your domain name. From there, click on the Advanced DNS tab. Click Add New Record to add each of the following five records:
Type | Host | Value | TTL |
---|---|---|---|
CNAME Record | www | yourusername.github.io | Automatic |
A Record | @ | 185.199.108.153 | Automatic |
A Record | @ | 185.199.109.153 | Automatic |
A Record | @ | 185.199.110.153 | Automatic |
A Record | @ | 185.199.111.153 | Automatic |
Click Save All Changes and delete any additional records that may conflict with those you've just entered.
That's it! It should take approximately 30 minutes for the changes to go into effect. Once they do, you will be able to access the content in your GitHub Pages repository from the custom domain you registered with Namecheap.
Top comments (3)
Had to log in just so i can thank you! FYI still works in october 2023
Thank you!
Thanks for this, very straight forward, was helpful to me!