Hosting Your Static Website for Free with GitHub: A Comprehensive Guide

Host your static website for free with GitHub using our comprehensive guide. Follow our step-by-step instructions to get your site up and running quickly

Disclaimer

There are many ways to host static website for free. In this guide we will use github as a hosting platform. Github can only host static websites*

Prerequisites

  • Github account
  • Code for your website

Main

Step 1: Click the “+” icon and click “New repository”

source

Step 2: Set basic info

Keep a name for your repository. Adding ‘.github.io" at the end of your repo name is important

Make sure “Add a README” file is checked

“Create repository”

source

Step 3: add your code

Upload your code like so

source

source

Step 4: Enabling github pages

Go to settings > Pages

source

Select “main” as source and “save”

source

Your site domain will be given

[optional] Step 5: Custom Domain

Enter your custom domain as shown and “save”

source

Add these DNS settings on your domain:

Type Name IP
A [domain-name] 185.199.108.153
A [domain-name] 185.199.109.153
A [domain-name] 185.199.110.153
A [domain-name] 185.199.111.153
CNAME www [github-repo-name]

Your DNS table should look something like this:

source

this DNS table is for mansoor.cf with github

that’s it ✌🏽