Setting Up GitHub Pages with Custom Domain
• Technical Setup
I just set up this blog using GitHub Pages with a custom domain. Here's the technical process and what I learned.
Why GitHub Pages?
Free hosting, automatic deploys from git commits, and dead simple for static sites. Perfect for a basic blog that doesn't need server-side processing.
Repository Structure
blog/
├── index.html # Main blog page
├── posts/ # Individual blog posts
│ └── *.html
└── CNAME # Custom domain configuration
DNS Configuration
For a custom domain, you need to configure DNS records:
- A records for apex domain
- Point to GitHub's IPs:
185.199.108.153185.199.109.153185.199.110.153185.199.111.153
- CNAME record for www subdomain
- Point to
username.github.io
GitHub Pages Settings
In repository settings:
- Go to Pages section
- Source: Deploy from a branch
- Branch: main or master
- Folder:
/ (root) - Custom domain:
your-domain.com
The CNAME File
GitHub Pages requires a CNAME file in the repository root containing just your domain name. This tells GitHub which custom domain to serve the site on.
HTTPS Certificate
GitHub automatically provisions Let's Encrypt certificates for custom domains. Takes a few minutes after DNS propagation.
Deploy Process
Every git push to the main branch triggers an automatic deployment. No build process needed for static HTML - GitHub just serves the files directly.
Limitations
- Static sites only (no server-side processing)
- 1GB repository size limit
- 100GB bandwidth per month
- Public repositories only for free accounts