Convert Github Domain to Your Own Public Domain

Apr 23, 2025 min read

website

Connecting Your Domain to GitHub Pages

Welcome back to my blog! Today, we’re going to walk through the step-by-step process of connecting your custom domain with the .site extension (in this example, yuswitayudi.site) to the website you’re hosting on GitHub Pages (yuswitayudi.github.io). By following this tutorial, your website will be accessible through your chosen web address.

Why Use a Custom Domain?

Using a custom domain gives a more professional and memorable impression to your website visitors compared to a github.io subdomain.

Prerequisites:

  • You already have a website hosted on GitHub Pages (for example, in the username.github.io repository).
  • You already own a custom domain (in this example, yuswitayudi.site) and have access to the DNS control panel from your domain registrar.

Step 1: Adding a CNAME File to Your GitHub Pages Repository

The CNAME file tells the GitHub Pages server which custom domain should be associated with your website.

  1. Open Your GitHub Repository: Navigate your browser to your GitHub account and open the repository that hosts your GitHub Pages website (most likely yuswitayudi.github.io).
  2. Create a New CNAME File: On the main page of your repository, click the “Add file” button located above the list of files. Select “Create new file” from the dropdown menu.
  3. Name the CNAME File: In the filename field, type exactly CNAME (all capital letters, with no extension). Make sure there are no spaces or extra characters.
  4. Enter Your Custom Domain: In the content area of the file, enter your custom domain.
    • If you only want to use yuswitayudi.site:
      yuswitayudi.site
      
    • If you also want www.yuswitayudi.site to point to your website, add a new line:
      yuswitayudi.site
      www.yuswitayudi.site
      
  5. Save Your Changes: Scroll down and write a commit message (for example, “Add CNAME file”). Click the “Commit new file” button.

Step 2: Configuring DNS Records at Your Domain Registrar

Now, we need to tell the Domain Name System (DNS) that yuswitayudi.site should point to the GitHub Pages servers. These steps are done through the DNS control panel provided by where you purchased your yuswitayudi.site domain.

  1. Access Your DNS Control Panel: Log in to your account at the domain registrar where you bought yuswitayudi.site. Find the section that manages DNS, DNS settings, or DNS zone for the yuswitayudi.site domain. The menu name might vary slightly depending on the registrar.
  2. Add A Records for the Root Domain (yuswitayudi.site): You need to add several A records that point to the IP addresses of the GitHub Pages servers. This ensures availability if one server experiences issues. Create four new A records with the following settings (adjust if there are differences in your control panel):
    • Type: A (Address)
    • Host/Name: @ or leave blank (depending on the registrar)
    • Value/Points To/Address:
      185.199.108.153
      185.199.109.153
      185.199.110.153
      185.199.111.153
      
    • TTL (Time To Live): Usually set to the default value (for example, 3600 seconds or 1 hour).
  3. Add a CNAME Record for the www Subdomain (www.yuswitayudi.site): If you also want www.yuswitayudi.site to point to your website, create a CNAME record. Create one new CNAME record with the following settings:
    • Type: CNAME (Canonical Name)
    • Host/Name: www
    • Value/Points To/Target: yuswitayudi.github.io. (Note the period at the end)
    • TTL: Usually set to the default value.
  4. Save Your DNS Changes: After adding all the necessary records, make sure to save the changes in your domain registrar’s DNS control panel.

Step 3: Waiting for DNS Propagation

DNS changes take time to propagate across the internet. This process is known as DNS propagation and can take anywhere from a few hours to a maximum of 48 hours. During this time, your website might still be accessible through yuswitayudi.github.io or might not be accessible through yuswitayudi.site yet. Be patient!

Congratulations! You have successfully connected your custom domain yuswitayudi.site to your GitHub Pages website. Now visitors can access your website through a more personal and professional address.

If you encounter any difficulties or have further questions, just re-read! (kidding)

note: you can also connecting or manage your dns using cloudflare as third party DNS management and also included HTTPS.