username.github.io, your guests can visit yournames.com.
Prerequisites
- Your website deployed on GitHub Pages
- A domain name (you’ll need to purchase one if you don’t have it)
Domain Configuration Process
Purchase a Domain
You’ll need to buy a domain from a domain registrar:
Popular Domain Registrars
Namecheap
Affordable pricing, easy to useStarting at $8-15/year
Google Domains
Simple interface, reliableStarting at $12/year
GoDaddy
Popular, many featuresStarting at $10-20/year
Cloudflare
At-cost pricing, includes CDNStarting at $8-10/year
Choosing a Domain Name
Popular formats for wedding websites:firstnamewedsecondname.com(e.g.,ankitawedsanil.com)firstname-and-secondname.comfirstnamelastname.comthe-lastname-wedding.com
Create CNAME File
In your GitHub repository, create a file named This file tells GitHub Pages which custom domain(s) to use for your site.
CNAME (all caps, no extension) in the root directory.Adding CNAME via Git
Adding CNAME via GitHub Web
- Go to your repository on GitHub
- Click Add file > Create new file
- Name it
CNAME - Add your domain name(s), one per line
- Click Commit new file
Replace
yourdomain.com with your actual domain name. Include both the root domain and www subdomain for flexibility.Configure DNS Settings
Log in to your domain registrar and configure DNS records:
Add A Records
Point your root domain to GitHub Pages servers:| Type | Name | Value | TTL |
|---|---|---|---|
| A | @ | 185.199.108.153 | 3600 |
| A | @ | 185.199.109.153 | 3600 |
| A | @ | 185.199.110.153 | 3600 |
| A | @ | 185.199.111.153 | 3600 |
Add CNAME Record
Point your www subdomain to your GitHub Pages URL:| Type | Name | Value | TTL |
|---|---|---|---|
| CNAME | www | username.github.io | 3600 |
Example: Namecheap DNS Settings
Update GitHub Pages Settings
- Go to your repository on GitHub
- Navigate to Settings > Pages
- Under Custom domain, enter your domain name
- Click Save
- Wait for DNS check to complete (green checkmark will appear)
- Enable Enforce HTTPS (recommended for security)
It may take a few minutes for GitHub to verify your DNS configuration. If it fails initially, wait an hour and try again as DNS records propagate.
Domain Configuration Examples
Example 1: Root Domain Only
If you want your site accessible atyourdomain.com:
Example 2: Root and WWW (Recommended)
For bothyourdomain.com and www.yourdomain.com:
Example 3: Subdomain Only
For a subdomain likewedding.yourdomain.com:
Verification Steps
After configuration, verify your setup:Check DNS Propagation
Use DNS Checker to see if your DNS records have propagated globally.
Test Domain Access
Try accessing your site using:
http://yourdomain.comhttps://yourdomain.comhttp://www.yourdomain.comhttps://www.yourdomain.com
Troubleshooting
Domain not connecting after 48 hours
Domain not connecting after 48 hours
- Verify DNS records are correct (use DNS Checker tool)
- Ensure CNAME file exists in repository root
- Check that GitHub Pages custom domain is saved in settings
- Try removing and re-adding the custom domain in GitHub settings
HTTPS not available
HTTPS not available
- Wait 24 hours after initial DNS configuration
- Ensure DNS records are properly configured
- Try unchecking and re-checking “Enforce HTTPS” in GitHub settings
- Remove and re-add custom domain if issue persists
WWW not working
WWW not working
- Verify CNAME record points to
username.github.io - Ensure www is listed in your CNAME file
- Check DNS propagation for www subdomain specifically
Certificate error or security warning
Certificate error or security warning
- Wait for GitHub to issue SSL certificate (can take 24 hours)
- Verify custom domain is properly saved in GitHub settings
- Clear browser cache and try again
Best Practices
Use HTTPS
Always enable “Enforce HTTPS” for secure guest connections
Test Both Versions
Verify both root domain and www subdomain work correctly
Keep Records Updated
Save your DNS configuration for future reference
Monitor Expiration
Set reminders to renew your domain before it expires
Next Steps
Test Your Website
Thoroughly test your site before sharing with guests
GitHub Pages Guide
Learn more about deploying to GitHub Pages
