Host Your Websites Now For Free

Host Your Websites Now For Free

So When we start our tech carrier what's there in our mind??

  1. Getting a Good Job?

  2. Become the best in coding?

  3. Getting A good package?

    But Life is not a joke we can not get anything easily.

What are Static Websites?

  1. A static website is delivered to a user exactly the way it's stored. That means that nothing on the page will change by the user or even the site administrator unless there's a redesign of the site, or the site administrator goes directly into the code to change it.


    Why host Static Website?

    Just think You are a beginner in the tech industry you learned HTML, CSS and Javascript and made something like a game? or first page. or a blog page?

    or a CV as an static website?

    Now just think you are having a personal website with all your information as a cv now you want to show that to any society or company so that they can get to know about you, But you cannot show them that webpage Because it is in your local Computer not on any Server.

    Here This Blog is going to help you the most.

Where to Host?

As a developer, you must have heard of GitHub. So that is our server for now and we are going to host our first static website there.

I am recommending you my video for that so that it will become easy for you. Check my channel CodeByMayank. Link: https://www.youtube.com/channel/UC2LixqyQF1tvGUhaVXT3TRQ

Lets Host:

  • Firstly, Create a file named index.html.

  • And Add some Code for HTML or your website. This going to be a demo Blog so I will just create a demo webpage for that, As shown Below.

  • Now Just create a repository in github name it like:- <your_username>.github.io

  • And also check the box to add a readme file.

  • Now create a folder named git and open that folder.

  • Now go into GitHub Repo and copy the https link.

  • Now just open that directory in cmd. (You can checkout my video)

  • Now we have Some commands to remember.

  • 1. git add . (what this command do is it will add all file in that directery)

  • 2. git commit -m "comment" (It is clear with this command we will add any comment to this folder)

  • 3. git push (This command will push your file to GitHub)

  • If you were not logged in it will give you an error then you can log in and again push this file your error will be solved.

  • Now everything is done go to the actions section in the GitHub repository and when your site is successfully deployed you can open that.

    Why we used .github.io?

    This is because this username.github.io is an auto-generated base URL by GitHub.

  • This means that if you will host any other website on Github than this is going to be our base url.

  • So let us see that.

How .github.io acts as an base url.

  • Steps are going to be same as we did it earlier, But some additional steps are there.

  • Now create a repository and name it anything, lets name it as 'contactme'.

Now clone this repo and create a webpage as we did earlier and push it on github.

  • Now if you go into actions section there will be no deployment, as this is a normal repository so we need to convert it into a page.

So for doing this just go to Settings.

Now go to pages in left nav.

  • Now we can see deployment settings.

  • Here what we need to do is to change branch to main.

  • We can also add custom Domain But i ill demonstrate you that next time.

  • Now go to action and there this webpage will start to deploy.

  • Once the deployment is done open it there you will see that url for this page is <username>.github.io/contactme.

  • This tells us that it is acting as an Base Url.

    Make Sure to Check my Youtube Channel!!


Did you find this article valuable?

Support Mayank Aggarwal by becoming a sponsor. Any amount is appreciated!