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
- How to Build Portfolio Website And Host It on GitHub Pages?
- How to Deploy a Basic Static HTML Website to Heroku?
- How to Publish Your Android App on Google Play Store?
- How to Publish Your Android App on Amazon App Store for Free?
- GIT | An Introduction to Github
- Using Bitbucket as an extension to GitHub capabilities
- Downloading gists from Github made simple
- Making your first Open Source Pull Request | Github
- List of useful Github Commands
- Bitbucket vs GitHub vs GitLab
- An Ultimate Guide to Git and Github
- Fetch top 10 starred repositories of user on GitHub | Python
- 5 GitHub Repositories that Every New Developer Must Follow
- Creating Repository in GitHub
- What is GitHub Student Developer Pack and How to Get it?
- Top 10 Useful GitHub Repos That Every Developer Should Follow
- How to Deploy Your React Websites on GitHub?
- Using GitHub with SSH (Secure Shell)
- How to Upload a Project on Github?
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.