Hosting a website enables many web users to access our web pages at the same time. If you want to run a website you need web hosting because unless you’ve got unlimited funds you would not be able to afford the web servers. GitHub has a lot to offer, it provides free hosting to your static website. To host the website via GitHub you’ll require a valid git account, the git software and all the codes and files of your static website.
In this article we’re going to learn how to host a static website on GitHub, let’s get started:
Step 1: Create / Sign into your GitHub account.
Step 2: Click on create a New Repository, give it a name and make sure to make it public.
Step 3: Go to the directory where all the HTML files are present, right-click and select Git bash here which is going to open the command line.
Step 4: Give the command “git init” which will initialize a git repository.
Step 5: Give the command “git add .” which will add all the files into the repository.
Step 6: Now check the status of the repository by giving the command “git status“, if all the files are in green means the files are successfully stored in the repository.
Step 7: Give the command “git commit -m “my first commit” .” by which you give your first commit in git.
Step 8: Give the command “git remote add origin https://github.com/vaishnavigupta447/geek-sSite.git” which would be the url given in your github id. This will add the remote origin to your local git repository.
Step 9: To push your code in repository give the command “git push -u origin master“, which is going to ask your username and password.
Step 10: Go to the GitHub page, click on your project and you can see all the files are pushed in the repository. Go to the setting and find GitHub Pages, in the source section from the drop-down menu select master branch save the changes.And your Site is successfully published, copy the url and open it in the new tab.
And yes!! your page is published at free of cost. Share the link of your page and it can be accessed by numbers of web users at the same time.
- Using GitHub to host a free static website
- Issues in GitHub
- Making a Github Bot
- Difference Between Git and GitHub
- GIT | An Introduction to Github
- List of useful Github Commands
- How to add a README to your GitHub profile?
- An Ultimate Guide to Git and Github
- Creating Repository in GitHub
- How to Upload a Project on Github?
- Bitbucket vs GitHub vs GitLab
- Using GitHub with SSH (Secure Shell)
- Link your GitHub Account with R Studio
- How to Deploy Your React Websites on GitHub?
- How to Upload Project on GitHub from Pycharm?
- Using Bitbucket as an extension to GitHub capabilities
- Sync your fork with master in GitHub
- GitHub App to Add or Remove Labels to Issues
- 5 GitHub Repositories that Every New Developer Must Follow
- What is GitHub Student Developer Pack and How to Get it?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.