You will need a domain name from a registrar.
In the gh-pages
branch of your project repository, or the main branch of your username.github.io
repository, create a CNAME file with the contents www.yourdomain.com
- the canonical domain.
At your registrar's domain configuration page, point your domain to your GitHub website.
Set up two CNAME records (one for the root apex (@) and one for www). Both should point to username.github.io
or username.github.io/repository
.
If your DNS provider does NOT support ALIAS records on the root apex (@), simply create A records that point to 192.30.252.153 and 192.30.252.154.
GitHub instructions for a custom domain
Stack Overflow Q&A: "Custom domain for GitHub project pages"
Audrey Watters - Using GitHub to Power A Web Project: How and Why
Alex Cican - How I moved my websites to Dropbox and GitHub
Treehouse - Using GitHub Pages To Host Your Website