Using custom domain for GitHub pages

Search for a command to run...

No comments yet. Be the first to comment.
👋🏽 Hello there, I recently moved my primary blog at hossain.dev GitHub's Spark is a fantastic starting point for building modern React applications that uses spark-template as starting point. Once
👋🏽 Hello there, I recently moved my primary blog at hossain.dev TL;DR: I let AI write a JSON5 parser for me using just test cases and vibes. No deep knowledge, just TDD and Agentic AIs. Shockingly

👋🏽 Hello there, I recently moved my primary blog at hossain.dev Building is more fun with AI 🤖 I’ve had my GitHub Copilot subscription for over a year now, but I haven’t leveraged the service unti

👋🏽 Hello there, I recently moved my primary blog at https://hossain.dev/ Have you ever needed to save your Android Logcat logs for later analysis? I recently built a service-based Android app, and

👋🏽 Hello there, I recently moved my primary blog at https://hossain.dev/ ℹ️ This is part of the self-learning log as I explore Docker and Portainer. Recently, I have been playing with Portainer — a

Recently I decided to host my personal portfolio site using GitHub pages. Even though they have very detailed instruction on how to setup a custom domain, I found it cumbersome to get to the right information. 🙄
Here are 2 key steps to setup your GitHub pages enabled project to use your custom domain.
Go to your GitHub Pages site’s repository settings. Under “Custom domain”, add or remove your custom domain and click “Save”.
Setting “custom domain” creates a file named **CNAME** in the same repository. Don’t delete it.
This step is specific to your domain name register (like GoDaddy, Domain.com, Google Domains, etc). All you need to do is set **A** & **CNAME** records for the selected domain.

This is a sample screenshot taken from the Google Domains portal.
For **A** record, set 185.199.108.153, 185.199.109.153, 185.199.110.153 and 185.199.111.153. To redirect **www** subdomain to the original domain, add a **CNAME** record with your GitHub pages profile URL with a .(dot) in the end, for example, ‘*YOUR-GITHUB-USERNAME.github.io.*’.
Official References*: For most up to date IP Addresses, use GitHub’s [official documentation](https://help.github.com/articles/setting-up-an-apex-domain/) and for setting up CNAME use this [documentation](https://help.github.com/articles/setting-up-a-www-subdomain/).*
That’s it, both www.your-domain.com and your-domain.com will now go to your selected GitHub pages site (may need to wait up to 24 hours). If you want to see a live example, you may visit my portfolio “hossainkhan.com” hosted via GitHub pages repository ✌️.
UPDATE #1: The IP addresses for DNS
Arecord is updated. The new IP addresses are required to use the free HTTPS support for GitHub pages.UPDATE #2: Some people said this change is not working, it is actually because the DNS update can take upto 24 hours to propagate. So, I guess try hitting your domain next day 🤓
NOTE #1: Even though it’s very obvious, you should replace
*YOUR-GITHUB-USERNAME*andyour-domain.comwith your personal github username and domain name you are trying to use respectively.