CraftedTemplate
Blog How to Host a Static HTML Template on GitHub Pages (Step-by-Step Guide)

How to Host a Static HTML Template on GitHub Pages (Step-by-Step Guide)

9/28/2025 • Festus Ayomike
How to Host a Static HTML Template on GitHub Pages (Step-by-Step Guide)

Introduction

If you’ve built a simple HTML template and want to put it online without spending a dime, GitHub Pages is one of the easiest hosting platforms to get started with. It’s free, reliable, and great for beginners. In this guide, you’ll learn how to host a static HTML website on GitHub Pages in just a few minutes.

How to Host a Static HTML Template on GitHub Pages (Step-by-Step Guide)

Why Use GitHub Pages?

  • 100% free hosting for static sites
  • No server setup required
  • Built-in HTTPS (SSL certificate)
  • Perfect for portfolios, landing pages, and small projects

Prerequisites

Before starting, make sure you have:

  1. A GitHub account (sign up at github.com).
  2. Git is installed on your computer (optional if you upload via web).
  3. A static website (e.g., index.html, CSS, and JS files).

Step 1: Create a GitHub Repository

  1. Log in to GitHub.
  2. Click the + New repository button.
  3. Name your repository (e.g., my-website).
  4. Set it to Public and click Create repository.

See Also: How to Deploy a Next.js Template to Vercel (Complete Tutorial)

Step 2: Upload Your Template

Option A: Upload via GitHub website

  • Drag and drop your HTML, CSS, and JS files into the repository.
  • Make sure you have an index.html file at the root.

Option B: Upload via Git

Code · batchfile
git init 

git add . 

git commit -m "Initial commit" 

git branch -M main 

git remote add origin https://github.com/username/my-website.git 

git push -u origin main

Step 3: Enable GitHub Pages

  1. Go to your repository → Settings.
  2. Scroll to Pages.
  3. Under “Branch,” select main and /root.
  4. Click Save.

Within a few minutes, your site will be live at: https://username.github.io/my-website

Step 4: Add a Custom Domain (Optional)

Want your own domain (e.g., mywebsite.com)?

  • Buy a domain from providers like Namecheap, GoDaddy, or Google Domains.
  • In Settings > Pages, add your domain.
  • Update your domain’s DNS records (CNAME → username.github.io).

Troubleshooting Tips

  • Page not loading? Double-check you have an index.html at the root.
  • CSS/JS not working? Use relative paths like ./style.css.
  • Still broken? Wait a few minutes—DNS & GitHub Pages sometimes take 5–10 minutes.

Conclusion

You’ve successfully hosted your first template on GitHub Pages! This method is perfect for portfolios, resumes, and static projects. Next, we’ll move to Vercel, which is ideal for React and Next.js templates.

Bookmark this guide and check out our full Hosting Academy series.

Part of the Hosting Academy

Follow the full beginner → pro path to deploy any Crafted Template.

Browse the series →