So are you searching for cheap hosting for your website I mean free hosting for your website with a custom domain so let's get started?
Hosting a website can be an expensive affair, especially for small businesses and individuals. But with GitHub Pages, you can host your website for free and even add a custom domain name to it. In this tutorial, we will guide you through the steps to host your website on GitHub for free with a custom domain in 2021.
Step 1: Create a GitHub account
The first step is to create a GitHub account if you do not have one already. GitHub is a platform for hosting code repositories, and it also offers free hosting for static websites through Github Pages.
Step 2: Create a new repository
After you have created your GitHub account, you need to create a new repository. To do this, go to the GitHub homepage and click on the "New repository" button.
Give your repository a name, and choose whether you want it to be public or private. Make sure to check the "Initialize this repository with a README" box.
Step 3: Add website files to the repository
Once you have created the repository, you need to add your website files to it. You can do this by uploading your files to the repository using the Github web interface or by using Git commands.
Make sure to add an index.html file to the root of your repository. This file will be the homepage of your website.
Step 4: Enable Github Pages
After you have added your website files to the repository, you need to enable Github Pages. To do this, go to the "Settings" tab of your repository and scroll down to the "GitHub Pages" section.
Under "Source", select "main" or "master" as your branch, and then select the root directory as your source.
Click on "Save" to enable GitHub Pages.
Step 5: Add a custom domain
By default, your website will have a URL in the form of <username>.github.io/<repository>. However, you can add a custom domain to your website to make it look more professional.
To do this, go to the "Settings" tab of your repository and scroll down to the "GitHub Pages" section.
Under "Custom domain", enter your domain name and click on "Save".
Step 6: Configure DNS settings
After adding your custom domain to Github Pages, you need to configure the DNS settings of your domain to point to Github's servers. To do this, you need to create a CNAME record in your domain's DNS settings.
The CNAME record should point to <username>.github.io.
Step 7: Wait for DNS propagation
After configuring the DNS settings, you need to wait for DNS propagation to take effect. This can take anywhere from a few minutes to several hours.
Once DNS propagation is complete, you should be able to access your website using your custom domain.
Conclusion
Hosting your website on GitHub Pages is a great way to host your website for free, and adding a custom domain makes it look more professional. By following the steps outlined in this tutorial, you can host your website on GitHub for free with a custom domain in 2021.