Hey guys! what’s going on? Today we will see how we can host a website on Github pages. Github Pages is a great way of hosting your static websites on the web.
In the Github pages, we can host directly from our GitHub repository. A repository is just a container in which you store all your code files. Just add, commit and push your code in the repo.
So, without further ado let’s get started!
Before starting we must have a Github account. So if you don’t have an account on Github go to https://github.com/ and make your Github account.
After creating the account, the first thing we need to do is to create a repo that will be hosted on the Github pages. So first click on New Repository to create a new repo.
Here is a very important step. Always keep in mind that your repo name should always be YOUR_GITHUB_USERNAME.github.io. If you will not name your repo with your Github username then your website will not get hosted on Github pages.
As my Github username is rits1272 I will name my repo as ‘rits1272.github.io’. So finally we are done with creating our Github repository.
Next, we just need to push the content of our site that will be visible in our Github pages.
NOTE: Your home page should be named as index.html. Because index.html is the page that Github pages look in your repo for hosting your main (home) page.
So simply push your website code files via git bash or by simply drag and drop interface provided by Github. So finally my final repo looks like this.
Thanks a lot for your patience. If you really enjoyed the article let me know with your claps and for any suggestions mention down in the comments. So see you all until the next time!