Setting up a custom subdomain
GitHub Pages is available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see "GitHub's products."
You can set up a custom subdomain, such as
blog.example.com, by creating a
CNAME record through your DNS provider.
Tip: If you have trouble configuring your CNAME record, then contact your DNS provider for help. They can help confirm that you have configured your custom domain correctly with their services.
For more information on custom subdomains, see "About supported custom domains."
CNAME record with your DNS provider
Contact your DNS provider for detailed instructions on how to set up the subdomain you added to your repository's
Follow your DNS provider's instructions to create a
CNAMErecord that points your subdomain to your default pages domain. For example, if you own the subdomain
www.example.com, you can configure a
CNAMErecord to point
YOUR-GITHUB-USERNAME.github.io. DNS changes can take over a full day to update, and the wait varies among DNS and hosting providers.
Danger: Do not use wildcard DNS records (e.g.
*.example.com) with GitHub Pages! A wildcard DNS record will allow anyone to host a GitHub Pages site at one of your subdomains.
Note: Your default GitHub Pages domain is determined by the type of pages site you have. For examples, see this domain chart.
To confirm that your DNS record is set up correctly, use the dig command with your custom domain. Using a custom domain as an example:
$ dig docs.example.com +nostats +nocomments +nocmd > ;docs.example.com. IN A > docs.example.com. 3592 IN CNAME YOUR-USERNAME.github.io. > YOUR-USERNAME.github.io. 43192 IN CNAME < GITHUB-PAGES-SERVER >. > < GITHUB-PAGES-SERVER >. 22 IN A 199.27.XX.XXX
Add your custom domain to your GitHub Pages site. If you're updating an existing custom domain, first remove and then re-add your custom domain to your GitHub account to trigger the process of enabling HTTPS. For more information, see "Adding or removing a custom domain for your GitHub Pages site."