Host website on Github pages
Okay first thing’s first, what is Github Pages, Github Pages is a static site hosting service. What that means is it will allow front end markup language and scripting but will not allow back-end scripting of any sort. So web projects based on PHP will not show up on your github pages.
You may ask: “Why would I want to host your web project on Github pages?” , because it’s free(I love free stuffs) and because you will have a website to show for in your resume or your profile, bio or anything like that.
So how do you setup github pages?
- Create a Github account.
- Develop a web project in your computer. (Something simple would be a nice idea to begin)
- Push you codes to a github repository on your account.
- Enable github pages on your repository’s Settings option.
Now let me walk you through each process mentioned above.
Create a Githbub account, here. If you code, even just a little, you would want to have a Github account. It is used for working on group projects, version control and code storage among many other things.
Next create a repository in your github by clicking the plus sign and then New Repository:
Github New Repo
Name your Repository and click Create Repository. And your repository is now created, where you can push codes from your local machine. You will see something like this:
Github Remote Repository
Now that your repository is all set up, you can push your local website to the repository itself. Now Github requires your computer to have Git installed on your machine. What? Git? Github?
So setup Git on your machine by going to their page.
After Git is setup on your machine, navigate to the folder where you have your website’s code and right click there holding the shift key. Click Open Command Window Here or open Terminal if you are on Linux.
This will open the command prompt on that folder then type in the following commands:
`git commit -m “first commit”`
`git remote add origin https://github.com/(your_github_username)/(repository_name).git`
`git push origin master`
and that will push all your website’s code into the github repository. If you want to know more on what these commands mean, read our article here. The only thing left now is to enable “github pages” on your repository’s settings.
Github Repository Settings
Scroll down on the settings page to find Github pages option. I believe it’s second last on the list, just above “Danger Zone”.
On the “Source” select master branch option. You will then see a message confirming that your site is published at
To show you that it works just fine, here is what I did with it. Haha, I am not a good web developer as of now. But I have seen people do some really cool stuff with it.
I hope that this post helped you land your website on the web. In addition to the advantages I mentioned earlier, you can now update your code from within the github itself or update the code locally and commit and push them and your site is updated.
If there is anything that I can help you with, do comment.