how to set up a custom domain github pages

"Customize Your Space: Setting Up a Personal Domain on GitHub Pages"

By David Robinson
AD

Setting up a custom domain for your GitHub Pages site is an excellent way to enhance your online presence and make your content easily recognizable. Follow these steps to achieve thisbrechen

Before you start, ensure you have a GitHub account, and you've created a repository for your GitHub Pages site. If you're unsure how to do this, check out the quick start guide provided by GitHub itself.

Purchase and Connect Your Domain

First, you need to purchase a domain name from a domain registrar like Namecheap, GoDaddy, or Google Domains. Choose a name that's unique, memorable, and relevant to your content or project.

AD
How To add a Custom Domain On Github Pages
How To add a Custom Domain On Github Pages
Set Up a Custom Domain for Your GitHub Pages
Set Up a Custom Domain for Your GitHub Pages
How to: Free Website Hosting + Custom Domain with Github Pages
How to: Free Website Hosting + Custom Domain with Github Pages

Once you have your domain, navigate to your domain registrar's website, find the DNS settings, and add a new CNAME record. Set the subdomain to "@" (without the quotes) and the target to "yourusername.github.io" (replace "yourusername" with your GitHub username). Save the changes and wait for the DNS propagation, which can take up to 48 hours.

Verifying Domain Ownership

To grant GitHub access to manage your domain's DNS settings, you'll need to verify domain ownership. Most registrars allow you to add a TXT record for verification. Here's how you can do it using Namecheap as an example:

Set Up a Custom Domain for Your GitHub Pages
Set Up a Custom Domain for Your GitHub Pages
Modern GitHub Profile UI
Modern GitHub Profile UI

1. In your Namecheap dashboard, select the domain you want to connect to GitHub Pages.

2. Click on "Manage" and then "Advanced DNS."

AD

3. In the "Add New Record" section, select "TXT" from the record type dropdown.

4. For the "Host" field, enter your domain (e.g., example.com) or subdomain (e.g., www or blog).

5. In the "Value" field, paste the TXT record value provided by GitHub.

AD

6. Click "Save all changes" and wait a few minutes for the verification to complete.

Adding a Custom Domain to Your GitHub Pages Site

After verifying domain ownership, you can now connect your custom domain to your GitHub Pages site. Here's how:

1. In your GitHub account, navigate to "Your profile" > "Repositories."

AD

2. Find the repository associated with your GitHub Pages site and click on it.

3. Click on the "Settings" tab at the top of the repository page.

4. Scroll down to the "Custom domain" section and enter your custom domain name (e.g., example.com).

5. Click "Save" to connect your custom domain to your GitHub Pages site.

You should now be able to access your GitHub Pages site using your custom domain.

AD