Setting Up GitHub Pages

GitHub Pages is a free service offered by GitHub that allows you to create a website or blog for your project, personal brand, or business. By default, GitHub Pages provides a subdomain for your site, such as username.github.io. However, you can also use a custom domain name for your site, which can help you establish your brand and make your site more memorable.

In this tutorial, we will guide you through the steps to set up GitHub Pages with a custom domain.

Prerequisites

Before you begin, you will need the following:

Create a CNAME file

The first step is to create a CNAME file in the root of your repository. This file tells GitHub Pages which domain name to use for your site. To create the CNAME file, follow these steps:

For example, if your custom domain is "example.com", the contents of the file should be:

1example.com

Configure DNS settings

The next step is to configure the DNS settings for your custom domain name. You will need to add two DNS records: one for the root domain (e.g., example.com) and one for the www subdomain (e.g., <www.example.com>).

Here's how to do it:

1185.199.109.153
2185.199.110.153
3185.199.111.153

These four IP addresses belong to GitHub's servers, and they are used to host your website files.

Note: The DNS changes may take some time to propagate, so it may take a few hours for your custom domain to start working with GitHub Pages.

Update GitHub Pages settings

The final step is to update the GitHub Pages settings for your repository to use your custom domain name.

Here's how to do it:

Conclusion

Congratulations! You have successfully set up GitHub Pages with a custom domain. With this setup, you can create a professional-looking website or blog that reflects your brand or business.