Skip to main content

Managing a custom domain for your GitHub Pages site

You can set up or update certain DNS records and your repository settings to point the default domain for your GitHub Pages site to a custom domain.

Who can use this feature?

GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. See GitHub's plans.

Platform navigation

People with admin permissions for a repository can configure a custom domain for a GitHub Pages site.

About custom domain configuration

Tip

We recommend verifying your custom domain prior to adding it to your repository, in order to improve security and avoid takeover attacks. For more information, see Verifying your custom domain for GitHub Pages.

Make sure you add your custom domain to your GitHub Pages site before configuring your custom domain with your DNS provider. Configuring your custom domain with your DNS provider without adding your custom domain to GitHub could result in someone else being able to host a site on one of your subdomains.

The dig command, which can be used to verify correct configuration of DNS records, is not included in Windows. To verify that your DNS records are configured correctly, you can use the Resolve-DnsName PowerShell command or install BIND.

Note

DNS changes can take up to 24 hours to propagate.

Configuring an apex domain

To set up an apex domain, such as example.com, you must configure a custom domain in your repository settings and at least one ALIAS, ANAME, or A record with your DNS provider.

  1. On GitHub, navigate to your site's repository.

  2. Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the "Code and automation" section of the sidebar, click Pages.

  4. Under "Custom domain", type your custom domain, then click Save. If you are publishing your site from a branch, this will create a commit that adds a CNAME file directly to the root of your source branch. If you are publishing from a custom GitHub Actions workflow, no CNAME file is created, and any existing CNAME file is ignored and is not required. For more information about your publishing source, see Configuring a publishing source for your GitHub Pages site.

  5. Navigate to your DNS provider and create either an ALIAS, ANAME, or A record. You can also create AAAA records for IPv6 support. If you're implementing IPv6 support, we highly recommend using an A record in addition to your AAAA record, due to slow adoption of IPv6 globally. For more information about how to create the correct record, see your DNS provider's documentation.

    • To create an ALIAS or ANAME record, point your apex domain to the default domain for your site. For more information about the default domain for your site, see What is GitHub Pages?.

    • To create A records, point your apex domain to the IP addresses for GitHub Pages.

      185.199.108.153
      185.199.109.153
      185.199.110.153
      185.199.111.153
      
    • To create AAAA records, point your apex domain to the IP addresses for GitHub Pages.

      2606:50c0:8000::153
      2606:50c0:8001::153
      2606:50c0:8002::153
      2606:50c0:8003::153
      

Note

If your DNS provider automatically sets a default record, remove it before continuing.