How to Host Your Website for Free Using GitHub Pages

So, you’ve built your first website, a simple HTML, CSS, and JavaScript project, and now you want to show it to the world. The good news? You don’t need to pay for hosting. With GitHub Pages, you can host your website for free and share it instantly.
In this practical guide, you’ll learn step-by-step how to put your site online using GitHub Pages.
Step 1: What is GitHub Pages?
GitHub Pages is a service by GitHub that lets you host static websites (HTML, CSS, JS) directly from a GitHub repository.
-
No servers to manage.
-
No payments required.
-
Updates are as simple as pushing new code.
Step 2: Prerequisites
Before starting, make sure you have:
-
A GitHub account (sign up at github.com).
-
Git is installed on your computer (Read more on Installing git).
-
A basic project folder with files like:
Step 3: Push Your Website to GitHub
-
Open a terminal in your project folder.
-
Initialize Git:
-
Stage and commit your files:
-
Create a new repository on GitHub (no need to add README/license).
-
Link your local project to GitHub:
Step 4: Enable GitHub Pages
-
Go to your repository on GitHub.
-
Click Settings → Scroll to Pages.
-
Under Source, select '
main'
branch and click Save. -
GitHub generates a live URL like:
Your website is now live!
Step 5: Update Your Site
To make changes:
GitHub Pages automatically updates your site within minutes.
Limitations of GitHub Pages
-
Only supports static sites (HTML, CSS, JS). No server-side code like PHP or Node.js.
-
Custom domains are supported, but require additional setup.
Why Use GitHub Pages?
-
Perfect for portfolios, documentation, or small projects.
-
Free and reliable.
-
Teaches you real-world Git workflows.
Takeaway:
With GitHub Pages, you can publish your site today, no credit card, no complex setup. If you can push to GitHub, you can host a website.
You may also like
Comments
No comment yet