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> For my case, it was
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
Adding A records


Enforcing Https

Troubleshooting Https error

1. Mixed Content

Source: Github Help

2. HTTPS error

Add a CAA record





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


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