How to connect your domain to Github Pages
Want to link your domain to Github Pages? We can do that!
Configure Github Pages
First up, you need to prepare Github Pages for browser requests for your custom domain. Here's their guide that shows how to do it:
Setting up "www"
- Log in. You should arrive at the Domain Management screen. If you're already logged in, click your username in the top-right corner and select Domain Management.
- Click the black "gear" icon to the far right of your domain and click "DNS Records."
Add a new CNAME record:
Change Type to "CNAME - Canonical name record."
Under Host type: www
Under Answer type: YOUR-GITHUB-USERNAME.github.io …where YOUR-GITHUB-USERNAME is your actual username
Setting up your apex domain A records
Great, but what if someone visits your site but leaves out the "www?" According to the Github article "Setting up an apex domain," you must add two a A records to address that scenario. Here's how:
- On the Manage DNS Records screen, scroll down and locate the one or more A records that are currently pointing at the wrong web server. Click the trash can icons to the right of the bad records to remove them.
- Scroll up to the top of the Manage DNS Records screen to add the correct A records.
- For the first record, make sure that Type is set to "A - Address record" the Host is left blank and the Answer is 220.127.116.11 …then hit Add.
- For the second record, make sure that Type is set to "A - Address record" the Host is left blank and the Answer is 18.104.22.168 …then click Add.
- Click the X icon in the top right of the popup box to close "Manage DNS Records"
That's it! After five minutes or less, browser requests to your domain should start resolving to Github Pages.