GitHub isn’t just for storing code — it’s also a powerful way to host websites for free. Whether you’re looking to launch a personal blog, share your portfolio, or showcase a side project, GitHub Pages makes it easy to publish a static website straight from your repository.
In this guide, we’ll walk you through the simple steps to get your website live on GitHub — no hosting fees, no complicated setup.
Few Steps for Hosting Website on GitHub For Free
Here, we are going to discuss the step-by-step process of hosting a website on GitHub for free. So, you can also host your portfolio or your college project online with GitHub.
Step 1: Make a GitHub account
- The first step is to Make a GitHub account if you don’t have one already. You can Make an account for free on the GitHub website.
- If you already have one then do github login to your account.
Step 2: Create a new repository
-
To host your website on GitHub, you’ll first need to create a new repository.
-
After signing up or logging into your GitHub account, look for the “New” button on your dashboard or in the left sidebar.
-
Click it to start creating a new repository.
Now, here’s the important part:
If you want to host your main website (like a personal portfolio), name your repository exactly like this:yourusername.github.io
Replaceyourusername
with your actual GitHub username.For example, if your GitHub username is
bhushan123
, your repo should be namedbhushan123.github.io
.This naming format tells GitHub that you want to publish a personal website directly from this repository.
Once you’ve entered the name, click “Create repository” — and you’re ready for the next step!
.
-
Give the description of the website you are creating and then click on “create repository” button.
Step 3: Create an index.html file and a web.css file
- To create a website, you need an HTML file that contains the content of your website.
- You can create a new HTML file using a text editor like Visual Studio Code or Notepad.
- Save the file as “index.html” in your local repository.
Or
Click on ” creating new file” or “new file” to create a new file and name the created file.
Name the file with the “.html” extension so that you can add the HTML code for your website. Add the code for your website below in the edit section.
Add a description and “Commit changes” button so that your code gets added and saved on GitHub.
Add the CSS code for your website by doing the same process as above and then add a description and click on the “Commit changes” button.
Step 4: Enable GitHub Pages
- After pushing your code to your repository, you need to enable GitHub Pages for your repository.
- To do this, navigate to your repository on GitHub and click on the “Settings” tab.
- Scroll down to the “Pages” section from the left section.
Step 5: Visit your website
- Once GitHub Pages are enabled for your repository, your website is now live! You can visit your website by navigating to https://your-username.github.io/ in your web browser.
- It might take a few moments for the changes to propagate and for your website to be accessible.
Why Use GitHub to Host Your Website?
If you’re just getting started with web development or looking for a hassle-free way to publish a personal site, GitHub Pages is a fantastic option. Here’s why:
-
Free Hosting
GitHub Pages lets you host static websites completely free — no hidden costs, no subscriptions. You can even connect your own custom domain if you have one. -
Simple and Easy to Use
Setting up a website on GitHub is surprisingly easy. You don’t need any server knowledge — just upload your files and you’re good to go. -
Built-In Version Control
Every change you make to your website is tracked. If something breaks or you want to go back, you can easily revert to a previous version. -
Perfect for Developers
If you’re already using GitHub for your code, hosting your site there just makes sense. It keeps everything in one place and integrates smoothly with your workflow.
Final Thoughts
Hosting your website on GitHub Pages is one of the easiest and most cost-effective ways to get your content online. Whether it’s a personal blog, a project portfolio, or just a space to showcase your work — GitHub makes it accessible to everyone.
To get your site live, all you need to do is:
-
Create a new GitHub repository.
-
Add your website files (HTML, CSS, images, etc.).
-
Push your code to GitHub.
-
Enable GitHub Pages in your repository settings.
-
Visit your live website at
yourusername.github.io
.
The best part? Updating your site is as simple as making a new commit and pushing your changes. GitHub takes care of the rest.
So if you’re looking for a beginner-friendly way to host a static website — GitHub Pages is a smart, reliable, and free solution.
Also read: Microsoft Partners with Replit to Bring AI-Powered Vibe Coding to Azure Marketplace in 2025
Join Our Community
Stay updated with lineups, last-minute injury news, and expert picks by joining our Telegram & WhatsApp communities:
Platform | Join Link |
---|---|
Telegram | KhelTantra Telegram |
KhelTantra Whatsapp |