Verifying your custom domain for GitHub Pages

You can increase the security of your custom domain and avoid takeover attacks by verifying your domain.

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. For more information, see "GitHub's products."

About domain verification for GitHub Pages

When you verify your custom domain for your user account or organization, only repositories owned by your user account or organization may be used to publish a GitHub Pages site to the verified custom domain or the domain's immediate subdomains.

Verifying your domain stops other GitHub users from taking over your custom domain and using it to publish their own GitHub Pages site. Domain takeovers can happen when you delete your repository, when your billing plan is downgraded, or after any other change which unlinks the custom domain or disables GitHub Pages while the domain remains configured for GitHub Pages and is not verified.

When you verify a domain, any immediate subdomains are also included in the verification. For example, if the github.com custom domain is verified, docs.github.com, support.github.com, and any other immediate subdomains will also be protected from takeovers.

It's also possible to verify a domain for your organization, which displays a "Verified" badge on the organization profile. For more information, see "Verifying or approving a domain for your organization."

Verifying a domain for your user site

  1. In the upper-right corner of any page, click your profile photo, then click Settings. Settings icon in the user bar
  2. In the left sidebar, click Pages. Pages option in the settings menu
  3. On the right, click Add a domain. Add domain button on Pages settings
  4. Under "What domain would you like to add?", enter the domain you wish to verify and click Add domain. Domain text field and Add domain button on Pages settings
  5. Follow the instructions under "Add a DNS TXT record" to create the TXT record with your domain hosting service. DNS TXT record information on Pages settings
  6. Wait for your DNS configuration to change, this may be immediate or take up to 24 hours. You can confirm the change to your DNS configuration by running the dig command on the command line. In the command below, replace USERNAME with your username and example.com with the domain you're verifying. If your DNS configuration has updated, you should see your new TXT record in the output.
    dig _github-pages-challenge-USERNAME.example.com +nostats +nocomments +nocmd TXT
    
  7. After confirming that your DNS configuration has updated, you can verify the domain. If the change wasn't immediate, and you have navigated away from the previous page, return to your Pages settings by following the first few steps and, to the right of the domain, click and then click Continue verifying. Continue verifying option on Pages settings
  8. To verify your domain, click Verify. Verify button on Pages settings
  9. To make sure your custom domain remains verified, keep the TXT record in your domain's DNS configuration.

Verifying a domain for your organization site

Organization owners can verify custom domains for their organization.

  1. In the top right corner of GitHub.com, click your profile photo, then click Your organizations. Your organizations in the profile menu
  2. Next to the organization, click Settings. The settings button
  3. In the left sidebar, click Pages. Pages option in the settings menu
  4. On the right, click Add a domain. Add domain button on Pages settings
  5. Under "What domain would you like to add?", enter the domain you wish to verify and click Add domain. Domain text field and Add domain button on Pages settings
  6. Follow the instructions under "Add a DNS TXT record" to create the TXT record with your domain hosting service. DNS TXT record information on Pages settings
  7. Wait for your DNS configuration to change, this may be immediate or take up to 24 hours. You can confirm the change to your DNS configuration by running the dig command on the command line. In the command below, replace ORGANIZATION with the name of your organization and example.com with the domain you're verifying. If your DNS configuration has updated, you should see your new TXT record in the output.
    dig _github-pages-challenge-ORGANIZATION.example.com +nostats +nocomments +nocmd TXT
    
  8. After confirming that your DNS configuration has updated, you can verify the domain. If the change wasn't immediate, and you have navigated away from the previous page, return to your Pages settings by following the first few steps and, to the right of the domain, click and then click Continue verifying. Continue verifying option on Pages settings
  9. To verify your domain, click Verify. Verify button on Pages settings
  10. To make sure your custom domain remains verified, keep the TXT record in your domain's DNS configuration.

Did this doc help you?

Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Or, learn how to contribute.