Publishing GitHub page website on a custom domain with Https enforcement

Publishing your website on GitHub Pages

  1. Create a repo named as<your-github-username>.github.io. For my case, it was nikyadav.github.io.
Push code to repo
Settings Tab

Adding a Custom Domain

Step #1 Buy a domain

Step #2 Add a CNAME file

Creating CNAME file locally
  • Click on “Create New File”
  • Name the file “CNAME”
  • In the contents, add the domain name
Creating CNAME file from github
  • Click on the Settings tab
  • Scroll all the way down to Github pages section and under the custom domain, write your domain name.
  • Hit “Save”. This will add a CNAME file in your directory (No commit is required).
Creating CNAME file from Settings

Step #3 Add ‘A’ records

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
Adding A records

*Important*

Enforcing Https

Troubleshooting Https error

1. Mixed Content

Source: Github Help

2. HTTPS error

Add a CAA record

Congrats!

Congratulations

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nikhil Yadav ✌😎.ml

Nikhil Yadav ✌😎.ml

733 Followers

Product Designer at Gojek | Trying to read between the lines | Wish to document ’em all