Introducing Instant Domain Search Find Your Domains 10x Faster now.
India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Canada English
Canada Français
Netherlands Nederlands

How to Host a Static Website on GitHub Pages

Buy domains, business emails, hosting, VPS and more: Get Started

Cheapest Domains in Kenya

Get your .Co.ke domain now for just KSh 999 (Back to 1200 in 7 days)

.CO.KE for KSh 999 | .COM for KSh 999

Want to get a website online without paying for hosting or managing a server?

If your site is static, meaning it’s built with HTML, CSS, and JavaScript, GitHub Pages lets you do exactly that. 

It’s a free web hosting GitHub that reads your files from a repository and publishes them as a live website, complete with HTTPS and a public URL.

GitHub Pages works best for portfolios, documentation sites, landing pages, and personal blogs.

Before you begin, you’ll need three things:

  • An index.html file, your website saved as a single HTML file
  • A free GitHub account (sign up at github.com)
  • Optionally, Git is installed locally if you prefer the command line

You can get your index.html by building it yourself in a text editor like VS Code, exporting it from a drag-and-drop website builder, or generating one instantly using an AI tool like Claude.ai. Just describe your site and download the result.

You’ll learn how to host a static website on GitHub Pages with screenshots to help you follow.

Let’s get into it.

Step-by-Step Guide

Step 1: Create a New GitHub Repository

1. Sign in to your GitHub account at github.com.

2. Click the + icon in the upper-right corner and select New repository.

New repository image

3. Enter a repository name, something like my-static-site or portfolio.

4. Choose Public visibility. (Public is required for the free plan.)

web hosting GitHub

5. Click Create repository.

That’s your project home created. It’s like a folder on the internet that GitHub will read from to serve your site.

Step 2: Add Your Website Files

After creating the repository, you’ll land on a quick setup page.

1. Click on ‘uploading an existing file’.

web hosting GitHub

2. Drag and drop your index.html file into the upload area.

web hosting GitHub - index.html upload

3. Scroll down to the Commit changes section and click Commit changes.

Your file is now inside the repository. GitHub has it stored and ready.

Tip: If your site has additional files, such as a CSS stylesheet, images, or JavaScript, upload those too. Keep your folder structure the same as it is on your computer.

Step 3: Enable GitHub Pages

This is where your site goes live.

1. Go to your repository on GitHub.

2. Click the Settings tab (top menu, near the right).

GitHub setting

3. Scroll down to the Pages section in the left sidebar.

4. Under Source, make sure it says Deploy from a branch.

GitHub pages - source

5. Under Branch, click the dropdown that currently says None and select main.

GitHub Page - Branch (main)

6. Click Save.

GitHub will start building your site immediately. It typically takes about 2 minutes.

If the Branch dropdown doesn’t appear, your index.html may not have finished uploading yet. Wait a moment and refresh the page.

Check out ways to get a free domain.

Step 4 (Optional): Connect a Custom Domain

By default, your site will be live at https://yourusername.github.io/repositoryname.

That works perfectly for testing and personal projects. But if you want a professional address like www.yourname.com, you can connect a custom domain.

1. In your repository’s Pages settings, scroll to the Custom domain section.

web hosting GitHub

2. Enter your domain name (e.g., www.yoursite.com) and click Save.

3. Next, log in to your domain registrar and update your DNS settings to point to GitHub’s servers.

Don’t have a domain yet? You can register one quickly with us at Truehost, grab a domain here and pair it with GitHub Pages for a clean, professional URL at a very low cost.

Testing Your Website

GitHub Pages can take up to 5 minutes the first time it deploys.

While you wait:

  1. Go to Settings → Pages in your repository.
  2. Look for a green banner that says something like ‘Your site is live at https://yourusername.github.io/repositoryname.
  3. Click Visit site and confirm your page loads correctly.

If the page is blank or shows a 404, double-check that your file is named exactly index.html (lowercase) and that the main branch is selected as the source.

Check out our article on how to create a static website.

Ready to Go Live?

GitHub Pages makes web hosting on GitHub genuinely simple. You get a free, fast, globally distributed website with HTTPS, all without touching a server.

The one thing it can’t give you is a custom domain. For that, you need to register one separately.

We at Truehost make it easy and affordable. You can register your preferred domain with us and have it connected to your GitHub Pages site in minutes.

Static Website on GitHub Pages: FAQs

Can GitHub Pages host a website?

Yes, absolutely. GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub and publishes a website. It’s free to use on public repositories and gives every site a live URL under the github.io domain.

Are static websites good for SEO?

What are the limitations of GitHub Pages?

What are some GitHub Pages alternatives?

What are the disadvantages of a static website?

Are GitHub Pages only for static sites?

How many sites can you have on GitHub Pages?

Cheapest Domains in Kenya

Get your .Co.ke domain now for just KSh 999 (Back to 1200 in 7 days)

.CO.KE for KSh 999 | .COM for KSh 999

Winny Mutua
Author

Winny Mutua

SEO Specialist Nairobi, Kenya

Winfred Mutua is a results-driven SEO Specialist with over 5 years of experience in technical SEO, keyword strategy, and organic growth. She helps tech and web hosting brands improve visibility, rankings, and conversions through in-depth keyword research, content optimization, and technical SEO.
Proficient in SEMrush, Ahrefs, Screaming Frog, Google Analytics, and Search Console.
What She Excels At

- Technical SEO audits & site optimization
- Keyword research and search intent analysis
- SEO content strategy & long-form content creation
- On-page optimization and WordPress management
- Performance tracking and data-driven growth

Currently an SEO Content Specialist at Truehost Cloud, driving organic growth for a tech/web hosting brand. She has also built and scaled two niche WordPress websites from scratch, achieving monetization through organic traffic.
Fully remote-ready and open to new SEO opportunities.

View All Posts