Host Your HTML Website for Free on GitHub Pages

Ann Jul 09, 2026

Looking to showcase your HTML website to the world without breaking the bank? GitHub Pages offers a free and robust solution for hosting your static websites. In this comprehensive guide, we'll walk you through the process of hosting your HTML website on GitHub Pages in a simple, step-by-step manner.

How to Host a Website for Free Using GitHub Pages
How to Host a Website for Free Using GitHub Pages

Before we dive in, ensure you have a basic understanding of Git and GitHub. If you're new to these tools, don't worry โ€“ we'll keep the explanations beginner-friendly. Let's get started!

Host Websites Free with GitHub Pages ๐Ÿš€๐Ÿ’ป
Host Websites Free with GitHub Pages ๐Ÿš€๐Ÿ’ป

Setting Up Your GitHub Repository

First, we need to create a repository on GitHub that will house your HTML website files.

a person pointing at a computer screen with the words build and host your website free on github
a person pointing at a computer screen with the words build and host your website free on github

1. Log in to your GitHub account and click the '+' icon in the top-right corner. Select 'New repository'.

Naming Your Repository

Host Your Website FREE on GitHub in 60 Seconds!
Host Your Website FREE on GitHub in 60 Seconds!

Name your repository in the format 'yourusername.github.io', replacing 'yourusername' with your GitHub username. This is crucial for GitHub Pages to recognize your repository as a website.

For example, if your GitHub username is 'johndoe', your repository name should be 'johndoe.github.io'.

Initializing Your Local Repository

How to have a Free Website on GitHub | ู…ูˆู‚ุน ุงู„ุฅู„ูƒุชุฑูˆู†ูŠ ู…ุฌุงู†ูŠ
How to have a Free Website on GitHub | ู…ูˆู‚ุน ุงู„ุฅู„ูƒุชุฑูˆู†ูŠ ู…ุฌุงู†ูŠ

Next, initialize a local Git repository on your computer where your HTML files are stored.

Open your terminal or command prompt, navigate to your project's directory, and type the following commands:

git init git add . git commit -m "Initial commit"

Connecting Your Local Repository to GitHub

Host a static website for FREE on GitHub
Host a static website for FREE on GitHub

Now, let's connect your local repository to the GitHub repository you created earlier.

1. In your terminal or command prompt, add GitHub as a remote:

How to: Free Website Hosting + Custom Domain with Github Pages
How to: Free Website Hosting + Custom Domain with Github Pages
How To Host Website On Github in 5 minutes | Free Hosting
How To Host Website On Github in 5 minutes | Free Hosting
three screens showing different types of webpages and the same type of website page
three screens showing different types of webpages and the same type of website page
Host a website in under 2 minutes (Github Pages)
Host a website in under 2 minutes (Github Pages)
10xDEV - Blog
10xDEV - Blog
resume hosting on github in 5 minutes free templates - jolieanoo
resume hosting on github in 5 minutes free templates - jolieanoo
How to Make a Website From Scratch With Domain and Hosting
How to Make a Website From Scratch With Domain and Hosting
Create a New Github Account โ€“ Host a Website
Create a New Github Account โ€“ Host a Website
8 Ways To Host Your Website Free : -
8 Ways To Host Your Website Free : -
GitHub Pages
GitHub Pages
Host Your Own Webapp, Personal Nameplate, or Personal Website For Free in Seconds at Github
Host Your Own Webapp, Personal Nameplate, or Personal Website For Free in Seconds at Github
How To Create A Free Website - with Free Domain & Hosting
How To Create A Free Website - with Free Domain & Hosting
Bhagavad Gita Digital Copy, Magento Website Development Tips, Portfolio Website, Portfolio
Bhagavad Gita Digital Copy, Magento Website Development Tips, Portfolio Website, Portfolio
How to host a website with Github
How to host a website with Github
How To Get A Domain Name & Website For Free โ€ข Homely Economics
How To Get A Domain Name & Website For Free โ€ข Homely Economics
Here's How to Build a Website From Scratch (Free Step-by-Step Guide)
Here's How to Build a Website From Scratch (Free Step-by-Step Guide)
Best Free Static Website Hosting with Custom Domain - Top 10 Hosting Platforms - Super Dev Resources
Best Free Static Website Hosting with Custom Domain - Top 10 Hosting Platforms - Super Dev Resources
Hosting a website for freeโ€Šโ€”โ€ŠGet started with Google Domains & Github Pages
Hosting a website for freeโ€Šโ€”โ€ŠGet started with Google Domains & Github Pages
Set Up a Custom Domain for Your GitHub Pages
Set Up a Custom Domain for Your GitHub Pages
Launch a Website with a Custom URL using Github Pages and Google Domains
Launch a Website with a Custom URL using Github Pages and Google Domains

git remote add origin https://github.com/yourusername/yourusername.github.io.git

Pushing Your HTML Files to GitHub

Push your local HTML files to the GitHub repository using the following commands:

git push -u origin master

Enabling GitHub Pages

With your HTML files now on GitHub, it's time to enable GitHub Pages for your repository.

1. Go to your repository on GitHub and click on the 'Settings' tab at the top.

Selecting the Source

Scroll down to the 'GitHub Pages' section and click 'Edit'.

Under 'Source', select 'main' branch (or 'master' if that's your primary branch).

Choosing a Theme (Optional)

If you'd like, you can choose a theme for your website from the 'Themes' dropdown menu. Selecting a theme will apply a basic design to your website.

Once you've made your selections, click 'Save'. GitHub will now build your website, and you can view it by clicking the link provided under the 'Your site is published at' message.

Congratulations! You've successfully hosted your HTML website on GitHub Pages. Now, share your creation with the world and keep refining your web development skills. Happy coding!