This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

GitHub Pages Custom Domain & Deployment Cheatsheet

A quick reference guide for deploying sites and configuring custom apex domains and subdomains on GitHub Pages: CNAME, ALIAS, and A record configurations.

· Published

GitHub Pages provides static web hosting directly from a GitHub repository branch.

Custom Domains

CNAME File Setup

$ echo "foobar.com" > CNAME
$ git add CNAME
$ git commit -m "Add custom domain" && git push

Create a CNAME file in the root or publish directory (docs/ or gh-pages branch) containing your custom domain.

See: Configuring a custom domain for your GitHub Pages site (github.com)

DNS Record Configuration

Subdomain (e.g. www.example.com or blog.example.com):

CNAME => username.github.io

Apex / Root domain (example.com via ALIAS / ANAME):

ALIAS => username.github.io

Apex / Root domain (via A records):

A => 185.199.108.153
A => 185.199.109.153
A => 185.199.110.153
A => 185.199.111.153

References

Related topics