To point your own domain name like one from GoDaddy, Spaceship, or Webhostingpad to a GitHub Pages site, you need to use the A records in DNS settings. Specifically, you need to configure the DNS settings with the domain registrar (GoDaddy, Webhostingpad, etc.) and update your GitHub Pages settings. You will need to create A records, i.e., Address Records, pointing to the GitHub Pages IP addresses and verify the custom domain in GitHub.
Here’s a step-by-step breakdown:
Configure GitHub Pages Settings:
-
Go to your GitHub repository settings and navigate to the “Pages” section.
-
Verify your domain for GitHub Pages. This is verify that you do own the domain name, so that GitHub can apply HTTPS to it.
-
There are three types of customization
-
www domain
-
sub-domain
-
apex domain
-
-
Under “Custom domain,” enter your domain or sub-domain name (e.g.,
yourdomain.comorblog.mysite.com). -
GitHub will perform a DNS check and provide further instructions.
-
Consider verifying your custom domain in GitHub Pages for added security.
Configure DNS Records in Domain Registrar (Use Webhostingpad as an example):
-
Log in: Log into to your Webhostingpad account and access the DNS management area for your domain.
-
Add A (IPv4) and AAAA (IPv6) records: You’ll need to add four A records with the following GitHub Pages IP addresses: 185.199.108.153, 185.199.109.153, 185.199.110.153, and 185.199.111.153. Add four AAAA records as well if you want to use IPv6.
-
Record Type: Select “A” or “AAAA” for each record.
-
Name: For the root domain (e.g.,
yourdomain.com), use@in the name field. It is also fine to leave it blank, particularly in those web-based configuration systems where it adds the root domain automatically. -
Value: Enter the corresponding GitHub Pages IP address like
185.199.108.153and2606:50c0:8000::153for each record. -
TTL (Time to Live): Set the TTL to a reasonable value (e.g., 1 hour or less).
-
For sub-domain and www-domain, add CNAME record. For Name, it should be “www” or the sub-domain name like blog or map.
Verify DNS Changes:
-
It can take some time (up to 24 hours) for DNS changes to propagate.
-
Use tools like
dig(on Linux/macOS) orResolve-DnsName(PowerShell) to check if the A records are resolving correctly.-
Resolve-DnsName -Name mywebiste.com -Server ds5.wehostingpad.com -
Change the domain name and server address as needed.
-
-
Alternatively, use a website like whatsmydns.net to check the DNS propagation.
Important Notes:
-
CNAME Record (for
wwwsubdomain):While A records are used for the root domain, it’s recommended to also create a CNAME record for the
wwwsubdomain, pointing it to your GitHub Pages site’s default URL (e.g.,your-github-username.github.io). -
Some DNS providers offer ALIAS records, which can simplify the process. If available, you can use an ALIAS record instead of multiple A records for the root domain.
-
Security:
Verifying your domain with GitHub Pages is crucial for security and to prevent potential domain takeover attacks.
-
Troubleshooting:
If you encounter issues, double-check your DNS settings, ensure the domain is correctly added in your GitHub Pages settings, and allow sufficient time for DNS propagation.