How to Configure GoDaddy Custom Domains with GitHub Pages
The actual task of adding a custom domain to your GitHub page is quite easy, but different resources maybe more or less confusing. Below are the steps to go about hosting your GitHub page with a custom domain name. If you want to learn how to take your website, and host it on GitHub, then check out the following tutorial here.
- Buy a domain on GoDaddy.
- Go to your GitHub pages repository and click on the settings icon located in the upper righthand corner.
3. In the setting’s page, scroll down and then add and save your custom domain in the field provided (www.yourwebsitename.com)
4. Go to the root of your repository and create a CNAME file. Inside the file, type in either yourwebsitename.com or www.yourwebsitename.com. Some tutorials I have read specify you should not include the www, but this did not personally work for me. I would suggest to try yourwebsitename.com and if that does not work, repeat the tutorial with the www. Only make one CNAME file! If you repeat the tutorial, delete the old CNAME file and create a new one (or rather simply change the contents of the CNAME file).CNAME files also do not have an extension.
Make sure you commit these changes and be sure to pull the new changes.
5. Go to your GoDaddy account and click on the Domains tab
You should now see what domains you own in square boxes. In the upper right hand corner of this box, you should see a settings/gear icon. Click on this and then click on Manage DNS.
6. Now add an A Name record with host @ and that points to the IP address of your GitHub page and save the record.
7. Next, add a CNAME record with host www and point to the url of your GitHub page. Save the record.
8. (Optional) If the above steps don’t work, you can try to set it up so that it forwards to your GitHub page. Don’t do the previous steps AND this step as it will cause too many redirects for your website. If you chose the forwarding method, your custom domain will not apply to your GitHub page, but rather redirect your users to go to your GitHub page.
9. Now test your URLS to make sure it is working correctly. The changes may take a while before they show up. You can open up your terminal and use the command dig to find out the IP addresses of your GitHub page and custom domain. In the command line:
If you have setup your domain correctly, then your Github page and your custom domain url’s will point to the same IP address.
If you still are unable to get setup, contact GoDaddy and additionally be sure to check out this post by GitHub here.