Saturday 11 July 2020

Host a Static Site On GitHub Pages For Free

In one of my earlier post, I've discussed about how can you use GitHub to freely host a CSS or JavaScript file. But now we do not need to apply any of those tricks as GitHub came with their GitHub Pages.


GitHub Pages is a free service from GitHub which enable you to host your HTML repository on their github.io subdomain. In case if you have any custom domain of yours (such as .com or .net) , you can also link that.

If you don't exactly know about how you can make you static website live within few seconds , this post is for you.

Here, I'm going to share with you easiest way to host your repository online.

What are Static Pages?


Static Pages or Static Website means that all the files are written in the languages which are to be executed at client level. Such as HTML, CSS JavaScript and its libraries.

And if you are thinking about PHP or Python , GitHub Pages is not for that.

How to Upload Your Website On GitHub?


1.First of all, create an account on GitHub if you don't have. After that, Sign In.

Sign In to GitHub
Sign In to GitHub

2.After Sign In , Click on new repository and create one public repository. Incase if you want to host your private repo , you need to opt for GitHub's Premium plan.

Create new GitHub repository
Create new GitHub repository
3. Now once you've clicked on Create Repository , following page will appear.

Uploading repository on GitHub

4. Now there are usually 3 methods of uploading the repository. First is using Git , Second is by using GitHub for Desktop and third is manually uploading the file or creating a file.

You can also import code from another repository. That's great.

I'll go with manual uploading , because no installs required.

5. Once done with uploading, click on commit changes. Once that done - its time to deploy it to Pages!

Click on commit changes to commit repo

6. Final Step. Go to settings of repository and scroll down to GitHub Pages. Select Master Branch from the drop down and your site will be hosted at - yourusername.github.io/repo-name/

If you have any custom domain you can set it as well.

Selecting Master Branch That's it! If you have any related questions - comment down below.

2 comments:

  1. I have been reading your posts regularly. I need to say that you are doing a fantastic job. Please keep up the great work. for more info: CSS Tutorial

    ReplyDelete

Comment something useful and creative :)