Using GitHub to publish a HTML website

Recently stumbled on a pretty cool GitHub feature that allows you to publish a html website, where it will have a URL like I thought it would be a really cool way for kids to collaborate on building a simple website. Where they can all contribute to the one repository and with the way Github creates a new file (commits) anytime a file is changed if any errors or problems come about it can just be rolled back to a previous commit.

Below I’ll describe how to set up a free account, then publish a website and finally add collaborators.

Sign Up

  1. Navigate to and sign up for a new account

  2. Verify account and click create an account

  3. Choose free subscription and click continue

  4. Tailor experience or just skip if you like

  5. Verify email address ( check inbox)

  6. After verifying email address you should be redirected to this page.

Create Repo and Publish

  1. Navigate to repositories and click new

  2. Give the repo a name, set to public and click Create Repository

  3. Enter the repo and at a minimum you will need to click Create new file, and name it index.html. You could also add a css file and a folder for any images. To create a folder just use the / backslash in the new file dialog.
    Here is some starter html to get you going.

        <link rel="stylesheet" href="main.css">
<body style="background-color:orange;">
    <h1 align="center" style="color:blue;">Description or Title </h1>
    <h4>1. Hypno Shroom</h4>
    <p>In battlez it's best if you give plant food to a hypno shoom because if a zombie eats it the zombie will turn into a hypno gargantuar. The hypno gargantuar will destroy every zombie in it's way.
    <img class="bounce" src="./images/somrimge.png" alt="Hypno Shroom" style="width:30%;">

So add that to the index.html and save

  1. Still in the repository navigate to settings and scroll down to GitHub Pages. Set the source as master branch and save, you will then be provided with the URL for the published site.

So now the site is live if you want to add some friends to help build it out follow the steps below.

Add Collaborators

  1. Obtain your friends username

  2. Go to Settings and on the LHS click on Collaborators, search by their username and then Add collaborator

  3. They will be sent an email with a link which they can click to be added to the repository where thye can directly edit and add to the project.

Happy coding!!!

1 Like