Sometimes you just want to set up a quick website and it isn’t feasible to share your localhost. Github pages are a great way to do just that. The following walks you through the setup for a Github page.
Let’s get started:
Create Your Github Page
- Log into GitHub and create your GitHub repository.
-
Give your repository a name and description and then follow the directions for creating your new repository. The github repo for this tutorial will be called gh-data-1
-
As part of the setup process you will create a local folder for your project, initialize it for git and push it to your GitHub account. When you finish the setup process, there should be a README.md in your GitHub repository
-
In your local repository, create a new branch called gh-pages.
git checkout -b gh-pages
-
Add an index.html file in your local repository like the one below – just a blank template with a heading
<h1>My Page</h1>
- Push the gh-pages branch to your github repo
git add . git commit -m "Create the gh-pages branch and add index.html" git push origin gh-pages -u
- Now you can visit your GitHub Page to view your index.html file. http://hoitomt.github.io/gh-data-1/
That’s all for today. We now have a publicly accessible website for free.