Publish your websites for free using Git-Hub Pages!

Aayushi Mittal
2 min readApr 16, 2021

--

Github-Octocat

If you want to host your static website, so that anyone can see it live then you can use Github Pages! It is an amazing feature available on GitHub.
All you need is a Github account which you can create by signing up at https://github.com. Follow the steps mentioned below.

  1. Open https://github.com on chrome or any other web browser and then click on the “+” icon on the top right corner. And then click on create a new repository.
  2. Now Enter some details like the name of the repository and description. Choose the name wisely which describes your website well in two three words. You cannot use spaces between the names instead you can use underscores(_) or dash(-) to separate the words. A description is optional. Both name and description can be changed later if needed.
  3. Check the Add README.md file box. It will automatically create a branch named ‘main’ for you and create a README.md file in your repository. README files are basically used for describing the project written in markdown syntax. It can include details like technologies used, how to contribute, instructions for installation, features, etc. Then Click on create repository.
  4. Upload all the files and folders in your projects by clicking on Add Files and then click on Upload Files. You can select files from your PC or you can drag and drop them directly. After uploading commit files on the main branch directly. It will be better if you name your HTML file index.html. If you already uploaded it, then you can also rename it by navigating to that file and then by clicking on the pencil icon. You can change the contents as well as the name of the file and then you can commit it for saving the changes.
  5. This is the most crucial step. In the Navigation Bar, there will be a tab named settings. Click on it and scroll down to the bottom, just above the danger zone there is an option for Activating Github Pages. Select branch as main. And Done!

Now, wait for a few minutes! Your website will be hosted at:

https://{username}.github.io/{repository-name}/

** If you do not upload anything, then by default README file will be hosted.

If you are unable to see your website rename your HTML file to index.html or you can view your website by altering the link like this:

https://{username}.github.io/{repository-name}/{filename}.{extention}

** Replace {username} with your username.
** Replace {repository-name} with your repository name.
** Replace {filename} with your filename.
** Replace {extention} with the extension of your file. For eg- ‘.html’ in the case of website.

Isn’t it easy? Create a website, host it and show your work to the world! Hope this article helped you in some way! Thanks for reading.

--

--