Hosting website on GitHub pages for FREE

There aremany options for hosting your static website. There are even completely free ones. Among them I've found the Github pages the best free hosting for a static website. This is a instruction on how to host your website on GitHub pages for FREE.

Almaz Kunpeissov
Jul 16, 2020

1. Sing Up to and create repository.

We need to create an account on and create a new repository of a special type.

  • Go to, hit Sign up and complete the registration. alt text
  • After confirming the email address you will be redirected to the page for creating a new repository. alt text
  • Create a new repository.

    • Repository name should be: *github_login*, where github_login is the User name you have chosen. You can see it also in a field called Owner. In my case, the repository name shouldbe
    • Choose Public.
    • Check the Initialize with a README
    • Hit Create Repository
  • Check if it is working. Navigate tothe *github_login* and you must see the greeting page. If you see 404 error or anything else, delete the repository and start all over. Check the name of the repository,it should be exactly like your login and followed by

alt text

2. Adding HTML website.

Now we need to create a website you want to host on the internet. We can clone this repository to our computer and make changes to it or we can do it in the browser. For demonstration purposes, we will start with a browser.

  • On the page of the repository, push the Create new file button. alt text
  • Enter the name of the file: index.html. -Copy & Paste the following code:
<!DOCTYPE html>
<html lang="en">
        <!-- Required meta tags -->
        <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>How to host a website on GitHub pages for FREE</title>
        <!-- Stylesheets -->
        <link rel="stylesheet" href="" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

    <body class="bg-light">
        <div class="m-4">
            <div class="jumbotron">
                <div class="container">
                    <div class="row">
                        <div class="col-xl-8">
                            <h1 class="display-1 display-fix">Awesome</h1>
                            <span class="lead">My New and Awesome website hosted on GitHub pages</span>

            <div class="container py-5">
                <h2 class="display-4">Thanks</h2>
                <p class="lead">Thank you for reading this instruction<br>
                    <a href=""></a>
  • Commit this file to the repository. alt text
  • Open navigate to the *github_login* You will see a newly created website! Congratulations! alt text

3. Buy your domain name.

Adding custom domain name to the GitHub pages is quite easy too. We need to buy one first. You can buy it from whatever registrar you want. I like registrar.

  • Go to alt text
  • Find a desired domain name. I wanted to buy alt text
  • Click +, register, and pay for the domain name you want. alt text

4. Setting up a custom domain name for GitHub pages.

Now we will point your new domain to the GitHub pages.

  • Navigate to the repository page on Github. It should be:*github_login*/*github_login* and open Settings tab. alt text

  • Scroll down to the GitHub pages section and add your newly purchased domain name to the Custom domain field. alt text

5. Cloudflare DNS records.

We need to add new DNS records for our domain. For a number of reasons I like Cloudflare for that purpose.

  • Go to the and register there.
  • Add New Site. Type your domain name in the form
  • Select Free plan.
  • Now we need to delete all the DNS record here. alt text
  • And add DNS records we need. In the table below is how you need to type them in the empty field. They will be displayed a little differently after you hit the Add Record button.

    Type Name Value
    A @
    A @
    A @
    A @
    CNAME www @

  • Press Continue. alt text

  • Now we need to change nameservers on our registrar website(where you bought the domain name). alt text

  • Go to Open Details dropdown, find AUTHORITATIVE NAMESERVERS, click Edit. alt text
  • Delete old records and add assigned by the Cloudflare. alt text
  • Go to the and click Done, check nameservers.
  • Here

    • check Full encryption
    • ON to Always Use HTTPS
    • choose to minify everything
    • ON to Brotli
    • Done
  • It will take a sometime (they say up to 24 hrs) to change DNS record. alt text


We are actually done. We deployed a website to the internet without leaving a browser. Thank you!