Your next big idea starts with a name. Find yours
The blogWebsites & Hosting
THE NAMESILO BLOG

How to Point Your Custom Domain to GitHub Pages

3D illustration of connecting a custom domain to GitHub Pages using DNS configuration, showing domain routing, web hosting deployment, and GitHub website publishing on a blue SaaS-style banner

To point your custom domain to GitHub Pages, you need to configure your DNS settings. Create four 'A Records' pointing your root domain to GitHub's specific IP addresses (e.g., 185.199.108.153). Then, create a CNAME record for 'www' pointing to your github.io URL. Finally, add your custom domain in your GitHub repository settings.

What Is GitHub Pages?

GitHub Pages is free static site hosting directly from your repository. Perfect for portfolios, documentation, and project sites.

Component

Purpose

GitHub Pages

Hosts your static files

Custom domain

Your branded URL (yourname.com)

DNS records

Routes your domain to GitHub's servers

How it works: Your code lives in a GitHub repository. GitHub serves it at username.github.io. DNS records redirect your custom domain to that same content.

No hosting fees: GitHub handles the servers. You just configure DNS at your registrar.

Why It Matters

Professional presence: johnsmith.com looks better than johnsmith.github.io on a resume or business card.

Free hosting: No monthly server costs. GitHub Pages handles traffic, SSL, and uptime.

Developer workflow: Push to main branch, site updates automatically. No FTP, no deployment scripts.

Full control: Own your domain, keep your content portable. Switch hosts anytime by updating DNS.

Decision Framework: Apex vs Subdomain

Setup Type

Records Needed

URL Result

Apex domain

4 A records + CNAME for www

yourname.com

Subdomain only

CNAME record only

www.yourname.com

Apex domain (recommended): Visitors reach your site at yourname.com. Requires A records pointing to GitHub's IPs plus a CNAME for www.

Subdomain only: Uses just a CNAME record. Site only accessible at www.yourname.com, not the root domain.

Best practice: Configure both apex and www. GitHub automatically redirects between them.

Implementation Steps

Step 1: Add Custom Domain in GitHub Go to repository → Settings → Pages → Custom domain. Enter your domain and save. This creates a CNAME file in your repo.

Step 2: Create A Records for Root Domain In NameSilo DNS Manager, add four A records for @ pointing to GitHub's IPs:

185.199.108.153

185.199.109.153

185.199.110.153

185.199.111.153

Step 3: Create CNAME for WWW Add a CNAME record:

  • Host: www
  • Target: username.github.io (replace with your GitHub username)

Step 4: Wait for Propagation DNS changes take minutes to hours. Use dig yourname.com to verify records.

Step 5: Enable HTTPS After DNS propagates, return to GitHub Pages settings. Check "Enforce HTTPS." GitHub provisions a free SSL certificate automatically.

Step 6: Verify Visit your domain. You should see your GitHub Pages site with a padlock icon.

Common Mistakes

Forgetting to enforce HTTPS: After DNS propagates, you must manually enable HTTPS in GitHub settings. Without this, visitors see security warnings.

Leaving old DNS records: Existing A records or conflicting CNAME entries prevent GitHub routing. Delete old records before adding new ones.

Wrong CNAME target: The www CNAME must point to username.github.io, not username.github.io/repo.

Not adding domain in GitHub first: Add your custom domain in repository settings before configuring DNS. This prevents domain takeover attacks.

Impatience: DNS propagation takes time. The HTTPS checkbox won't appear until GitHub verifies your DNS.

What This Means for You

NameSilo's DNS Manager handles the A record arrays GitHub requires, add all four IPs easily.

Register your custom domain at competitive pricing, configure DNS in minutes, and launch your portfolio on GitHub Pages for free.

Frequently Asked Questions

What are the GitHub Pages IP addresses? 

185.199.108.153, 185.199.109.153, 185.199.110.153, 185.199.111.153

Is hosting on GitHub Pages free? 

Yes. Free for public repositories with generous bandwidth.

How do I enforce HTTPS on GitHub Pages? 

After DNS propagates, enable "Enforce HTTPS" in repository settings.

Why is my GitHub Pages custom domain not working? 

Check for conflicting DNS records or wait for propagation.

Can I use Cloudflare with GitHub Pages? 

Yes. Point Cloudflare DNS to GitHub's IPs.

What is an apex domain? 

The root domain without www (e.g., yourname.com).

Do I need to buy hosting to use GitHub Pages? 

No. GitHub provides hosting free.

Does NameSilo work with GitHub Pages? 

Yes. Full DNS management for A records and CNAMEs.

WRITTEN BY

NameSilo Staff

The NameSilo staff of writers worked together on this post. It was a combination of efforts from our passionate writers that produce content to educate and provide insights for all our readers.