GoDaddy Domain with GitHub Pages
Github provides docs to wire up your domain with your gh-pages, but I’m going to cover the easy steps to set up in 5 simple steps.
- First, the most difficult part… , decide on a domain name. Buy the domain of your choice, in my case it is jinnabalu.com
- Goto Godaddy, login with your credentials, On the home page click on profile icon right upper corner.
=> Select My Products => All Product => select Domains => Under Domain Portfolio select the domain you choose to configure the github pages.
3. Click on the domain, and switch to DNS tab, within the DNS management page you will need to make five changes using Add New Record button.
- In the Type “A” row update the IP address to: 185.199.108.153
(this will point your custom domain to GitHub’s server over HTTPS) - In the CNAME row with Name “www” input your gh-pages website (username.github.io), in my case it is jinnabaalu.github.io
- At the bottom click the “ADD” button and make 3 more Type “A” rows with the IP addresses of: 185.199.109.153, 185.199.110.153, 185.199.111.153
(don’t worry when you leave the page it will alphabetize the types)
4. Go to your git repo or the editor in the code, and create a new file named “CNAME” in the root of your directory with the domain you selected. In my case it is jinnabalu.com. In the “CNAME” file add your domain name purchased from GoDaddy.
5. Enable HTTPS:
Goto repository Settings => Code and automation => Pages
Check “Enforce HTTPS” in the Settings tab of your repo. This permission might take awhile because the certificate needs to be issued, but make sure you check this enforcement option when allowed.
You can confirm that your DNS is set-up correctly by using the dig
command in your terminal with your custom domain. You should see that your “A” Types point to the IP addresses that you had specified in GoDaddy’s DNS management page, in other words you’re pointing your DNS to GitHub’s server. Below is an example of the dig
command:
dig jinnabalu.com
Now your site is available on your domain, Initially it will load on http, as enforcing https will take time to be available on https.
https://jinnabalu.com
If you’re encountering any problems, this GitHub Troubleshooting Custom Domains documentation is a good reference.