How do I link my domain to GitHub Pages
In order to link your domain to the GitHub Pages, you need to take several simple steps:
1. Add a CNAME file to your repository in the GitHub account.
- Once you log into your GitHub account, click on your repository name:
Use CNAME for File Name and enter a domain you've purchased in the first line of the editing section. Then click on the Commit new file button at the bottom of the page:
In the GitHub Pages section, you should see your domain from the CNAME file:
2. Now you may create necessary records for your domain in your Namecheap account.
- Sign into your Namecheap account (The Sign In option is available in the top hat of the page).
- Select Domain List from the left sidebar and click on the Manage button next to your domain:
- Click on the Advanced DNS tab and find the Host records section > click on the Add New Record button (not able to edit Host Records?):
Here you will need to create three records for your domain:
- A record for @ pointing to 18.104.22.168
- A record for @ pointing to 22.214.171.124
- A record for @ pointing to 126.96.36.199
- A record for @ pointing to 188.8.131.52
- CNAME record for www pointing to your username.github.io (the username should be replaced with your actual GitHub account username):
Once all details are inserted, save them using the Save All Changes green button.
Normally, it takes 30 minutes for newly-created records to take effect.
3. Make sure that there are no conflicting records set for the same host and remove them, if there are any. The records you need to check may be of URL Redirect (Unmasked/Masked/Permanent Redirect), A or CNAME record types.
Here is the example of the conflicting records:
If you do not have a repository within your GitHub account, you can easily create one by clicking the button New repository on the home page:
Enter a name of your repository and use the Create repository button to save changes:
Once you've done so, GitHub will offer you to upload your site to the newly created repository. If you do not have a site created yet, you may use default layouts provided by GitHub. You need to select Settings from the top to select one:
On the next page, click on Launch automatic page generator in the GitHub Pages section:
Select the layout you prefer and Publish Page:
If you have any questions, feel free to contact our Support Team. They're available 24/7 for you.