Host website on GitHub for free

Dhyani Yashora
Nerd For Tech
Published in
2 min readJan 11, 2024

In a landscape filled with numerous web hosting solutions, GitHub has risen as a favored selection for hosting websites. There are many advantages to choose GitHub; Version control integration, User friendly setup, Cost free hosting, Custom Domain Support, Automated deployment.

To host a website in GitHub;

  1. Create a GitHub account.

This step is to those who don’t have an account already. Create an account in GitHub is free.

If you already have an account, login to it.

2. Create a new repository.

To create a new repository, click on the “Create repository” button. Give your repository name as “username.github.io”.

If you already created a repository with a different repository name, don’t worry skip this step and follow below steps to host the website.

3. Create the files and commit changes.

You can clone the repository to the local machine or use the GitHub space to implement the website and commit to the repository.

4. Enable GitHub pages.

Now it’s time to host the website. Open the repository then go to the “Settings” tab. You can find “Pages” under “Code and Automation” section in the left sidebar and click on that.

If you created repository name as “username.github.io”, skip below paragraphs and go for step 5.

If your repository name is different from “username.github.io”. Then select the “Branch” under “Build and deployment” section. Most cases it’s main branch. You can check the branch from the “Code” tab.

Then select the directory “/(root)”. If you worked on another directory choose that. After that click on the “Save” button.

Then click on the “code” tab, there is a small orange color dot above the files. Click on that dot, it will appear a popup click on “Details”.

It shows the backend process that what happen currently. After all steps are successfully completed, go back to “settings” tab. Then go to “Pages”.

5. Visit your website.

Now you can see the website link under “GitHub Pages”. It will take small time, refresh the website.

Thanks for reading and hope you enjoyed!

--

--

Dhyani Yashora
Nerd For Tech

Undergraduate at Faculty of Information Technology, University of Moratuwa, Sri Lanka