All developers know Github as service that enables code sharing and also helps you improve your code by using version control.
However, did you know that Github also offers Github Pages, a completely free hosting service?
In this tutorial, I’ll show you how to host a simple HTML website for free using Github.
Step #1. Create a Github account
You will need a Github account. For more details please go to github.com and signup. It will take just a few seconds.
Step #2. Create a repository
Go to your profile page. Your URL will look like this: github.com/your-username
- Click on the Repositories tab
- Click New
You’re going to create a new repository. The repository name should follow this pattern:
In my example, I’m using htmgarcia as my username
- Click the Create repository button.
Step #3. Create the home page
Now let’s go to your new repository. Starting from your profile:
- Click the Repositories tab
- Click your repository name
- Find the plus sign (+) and click it to create a new file.
On this new screen, you have two things to do:
- Give your file a name. In this case we recommend index.html
- Add the HTML code structure in the area below. If you are not familiar with HTML, we have a class that will help you get started.
- When you are done, scroll down and click the Commit new file button
Step #4. Check the result
In your browser type http://your-username.github.io to see the end result. In this example I’m using http://htmgarcia.github.io/ and this really example will only display a “hello world!” header.
It’s as easy as that. You can now add free pages using Github’s free hosting.