Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
How to get a Free Domain Name for AWS Web Hosting?
Next article icon

How to Host a Website on GitHub For Free?

Last Updated : 14 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

GitHub is not only a platform for version control and code management but also a great tool for hosting websites for free. Whether you want to host a personal blog, a project portfolio, or just showcase your work, GitHub Pages offers a simple way to publish a static website directly from a GitHub repository.

In this article, we'll discuss how to host a website on Github for free.

Host Website on Github For Free
How to Host a Website on GitHub For Free?

Steps for Hosting Website on GitHub

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: Create a GitHub account

  • The first step is to create a GitHub account if you don't have one already. You can create an account for free on the GitHub website.
  • If you already have one then do github login to your account.
Screenshot-2025-04-14-183847
GitHub

Step 2: Create a new repository

  • Next, you need to create a new repository to host your website.
  • To create a new repository, click on the "Create repository" button on your left section after the new registration.
  • You can also do it by clicking on the "new" button on your GitHub Dashboard.
  • Give your repository a name that corresponds to your username. For example, if your website is called "username", name your repository "username.github.io".
Create New Repository
Create new repository

Give the description of the website you are creating and then click on "create repository" button.

Name the repository
Name the repository as your username.github.io

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.

Create New File
Create new 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 HTML code
Create index.html and add  the HTML code for your website

Add a description and "Commit changes" button so that your code gets added and saved on GitHub. 

Commit HTML code
commit the  HTML code

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.

Add Css code
Create index.html and add  the CSS code for your website
Commit css code
Commit the CSS code

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.
GitHub pages
Go to pages in the left section in the settings

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.
Visit your hosted site
Final Hosted site
How to Host a Website on GitHub For Free?

Why Use GitHub for Website Hosting?

  • Free Hosting: GitHub Pages offers free web hosting with custom domains.
  • Ease of Use: It is easy to set up and requires minimal effort, especially for static websites.
  • Version Control: You can easily manage your website’s source code with GitHub’s version control system.
  • Integration with GitHub Projects: If you’re already using GitHub for version control, hosting your website is seamless.

Conclusion

Hosting your website on GitHub Pages is a great way to make your website accessible to the world for free. By following the steps above, you can easily host your website on GitHub Pages and share your content with the world. In summary, hosting your website on GitHub Pages involves creating a repository, setting up your local development environment, creating and customizing your website's files, committing and pushing your changes to GitHub, enabling GitHub Pages in the repository settings, and accessing your hosted website through the provided URL. Remember to regularly update and maintain your website by pushing changes to your repository.


Next Article
How to get a Free Domain Name for AWS Web Hosting?

A

abhishekg010
Improve
Article Tags :
  • GBlog
  • Web Technologies
  • Git
  • GitHub

Similar Reads

  • Using GitHub to Host a Free Static Website
    Having a personal or project website is important for showcasing your work. Fortunately, GitHub Pages offers a simple and free solution for hosting static websites directly from your GitHub repositories. In this article, we'll walk you through the process of creating and hosting a static website usi
    3 min read
  • How to get a Free Domain Name for AWS Web Hosting?
    A domain name is unique, easy to remember address of a website. It is a combination of letters or numbers or both google.com or yahoo.com. You can buy a domain name from companies like Namecheap, GoDaddy, namesilo etc. Every computer or a server has some unique name in form of strings of numbers whi
    12 min read
  • How to create a CV using HTML and host in GitHub ?
    In today's digital age, having an online presence is crucial, especially when it comes to professional endeavors. One effective way to showcase your skills, experiences, and accomplishments is by creating a compelling curriculum vitae (CV).  In this article, we are going to build a CV using HTML, an
    4 min read
  • Hosting A Static Website On Firebase For Free
    Building a web application is always a time-consuming job, especially for the beginner developers who have just landed their feet in the vast world of programming. And one of the most exciting parts is when the application is available for all to see. Being a new bee in programming most beginners la
    5 min read
  • How to Build Portfolio Website And Host It on GitHub Pages?
    Having an online portfolio is important for showcasing your skills and accomplishments. GitHub Pages provides a convenient and free platform for hosting your portfolio website. In this article, we will see how to build a Portfolio Website And Host It on GitHub Pages. Table of Content Creating a Port
    15 min read
  • How to Publish a Static Website on GitHub?
    Publishing a static website on GitHub is a great way to share your work with the world. GitHub Pages is a service offered by GitHub that allows you to host your static websites directly from a GitHub repository. In this article, we’ll walk you through the steps to publish your static website on GitH
    6 min read
  • How to Earn Money From GitHub?
    GitHub really is an amazing web-based platform helping more than 60 million developers, programmers, or users shape their future in an open-source manner. And when it comes to making a business open-source, then it means a freemium model is there which can satisfy the hunger of many clients and tech
    8 min read
  • How to Deploy Your React Websites on GitHub?
    Building a web application is always exciting for developers especially when you step into the programming world for the first time. You build the front end of your application after a lot of struggle and you want to showcase your skill, your creativity, and of course your hard work to the world. So
    6 min read
  • How to Fork a GitHub Repository?
    GitHub is a great application that helps you manage your Git repositories. Forking a GitHub repository is a common practice that allows you to create your own copy of a repository hosted on GitHub. In this article, we will learn more about Git-Fork and its uses. Table of Content What is GitHub Repos
    3 min read
  • Hosting Flutter Website On Firebase For Free
    Flutter is a user interface development software development kit. Flutter is an open-source project maintained by Google. It enables software developers to make beautiful natively compiled applications for IOS, Android, Web, and Desktop with a single code base. Although developing flutter applicatio
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences