Using A Custom Domain With Github Pages

I use Google Domains for my own domains so I will be using that in my example. The process is pretty simple if you are comfortable with configuring things like DNS Records, A Names, CNAME records etc. Nothing more complicated that that. The first step …


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Yosi Leyid

I use Google Domains for my own domains so I will be using that in my example. The process is pretty simple if you are comfortable with configuring things like DNS Records, A Names, CNAME records etc. Nothing more complicated that that. The first step is to purchase your domain name. After that is done navigave to the DNS section on your account.

Table of Contents

  • Custom CNAME Records
  • Custom A Records
  • Head Over To Github
  • Potential Errors

Custom CNAME Records

Now we are going to add a CNAME, during the process of setting up your custom domain in Github settings it will create a CNAME file in the root directory of your github pages site to compare to the CNAME here. For the CNAME we will add it like the image below. Set up both your Apex domain sitename.domain and a www subdomain. Set them both for your username <your-domain-name>.com.

Screenshot 2023-02-05 11 58 09 AM

Custom A Records

Then we will add 4 A records in the same panel.

Screenshot 2023-02-05 11 58 28 AM

Head Over To Github

Once you have all of that set up you will head over to GitHub and go to the repository you want to serve up. It is common for most github users to have a repo named {username}.github.io which will be served up on github.io as a subdomain using your username. Once you have made that repo (follow this tutorial to accomplish that if you don't have one) click on settings and head down to "Pages". In there scroll down to custom domain name settings and add your domain name. After it passes the checks click on "Enforce HTTPS" and you should be all set. If you run into any issues feel free to reach out to me. My contact info can be found in my GitHub profile.

Potential Errors

If you do not have everything set up exactly as it should be Github will throw you an error:

Both <your-domain-name>.com and its alternate name are 
improperly configured

Domain does not resolve to the GitHub Pages server. For 
more information, see (NotServedByPagesError). We recommend
you add an A record pointed to our IP addresses, or an ALIAS
record pointing to <your-username>.github.io.

If you run into this, check your DNS settings over where you manage those settings and make sure everything is set correctly.


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Yosi Leyid


Print Share Comment Cite Upload Translate Updates
APA

Yosi Leyid | Sciencx (2023-02-06T03:45:23+00:00) Using A Custom Domain With Github Pages. Retrieved from https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/

MLA
" » Using A Custom Domain With Github Pages." Yosi Leyid | Sciencx - Monday February 6, 2023, https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/
HARVARD
Yosi Leyid | Sciencx Monday February 6, 2023 » Using A Custom Domain With Github Pages., viewed ,<https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/>
VANCOUVER
Yosi Leyid | Sciencx - » Using A Custom Domain With Github Pages. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/
CHICAGO
" » Using A Custom Domain With Github Pages." Yosi Leyid | Sciencx - Accessed . https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/
IEEE
" » Using A Custom Domain With Github Pages." Yosi Leyid | Sciencx [Online]. Available: https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/. [Accessed: ]
rf:citation
» Using A Custom Domain With Github Pages | Yosi Leyid | Sciencx | https://www.scien.cx/2023/02/06/using-a-custom-domain-with-github-pages/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.