How to Host Static Website On GitHub + Custom Domain For Free 2020

In this article, i will tell you how you can host your website on GitHub for free, along with free hosting, you will also get a free SSL certificate and you can also add your custom domain. In this article I will show Step by step the process of how to host your static webpage only GitHub pages for free.

What is GitHub?

GitHub is an open source platform for coding and software development where millions of developers work together and create projects. 

github pages

Host Website On Github -

You can easily host static websites on github using GitHub pages for free. Let's see how to do it.

Create GitHub account -

First of all go to github.com and create a new GitHub account with filling up your names and emails and complete sign-up by verifying your email.

Download Github -

Download Github for Mac and Windows, according to your operating system. Now login with the account you just created.

Create repository -

In this next step create a new Github repository by clicking a New button. 
Give name to your GitHub repository your-username.github.io and click to create the repository button. Now your repository is created, where you host all your website code.

Upload Files -

After creating a new repository now upload your website HTML, CSS and JavaScript code then commit changes.
Your main page file must be named as 'index.html'.
You can also do this process with CLI(command line interface) or upload files manually. I am uploading files manually because in my case there is only one file index.html, if you have more than one files or folders in your case then you must use CLI.

Publish Site -


After uploading all files now go to GitHub pages by clicking the setting at the right corner.
Enable GitHub pages by selecting the main or master branch and saving it.
Now your website site is live you can access it by clicking the given URL.

Assigning A Custom Domain -

You can leave your website with this URL or you can add a custom domain that is very simple to add a custom domain to your GitHub website. You can easily set your GitHub website to a custom domain by following the simple steps given below.

Login to your domain provider and go to the DNS section of your domain.

Change your domain A records with GitHub IPs -
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Create CNAME Record, enter www in host and your_username.github.io.

To enforce HTTPS encryption for your website, select Enforce HTTPS. It can take up to 24 hours before this option is available and enable SSL certificate on your site.

0/Post a Comment/Comments

Previous Post Next Post