Hello Everyone!
Let’s talk about hosting, once again. I have talked quite a lot about hosting in other articles, but this one is different.
If you want to launch a simple website but don’t want to go through the dull process of setting up yet another hosting package. There is an easier solution. If you just want to launch a simple static website you can use GitHub Pages to host your site for free.
GitHub is not only a great place to store and share your code with others but they also offer free web hosting of your HTML, CSS, and JavaScript projects!
Steps to host your page on GitHub:
- Signup for GitHub account: Visit github.com, and you’ll see a signup form on their front page. (If you don’t, congrats, you already have an account!)
- Download and install the GitHub desktop app: This is the app that we’ll use to get our code up on GitHub. It’s easy to use so don’t fret; the user interface is easy to learn!
- Create a Git repository: Open up the GitHub Desktop app and click the “Create New Repository” button.
When the “Create a New Repository” dialog window appears, fill in the “Name” text input as:
[username].github.io
Name your repository in this manner will tell GitHub to host the files in this project automatically and display them when someone points their browser to:
https://[username].github.io/
This will be the web address you will share when your site is ready to publish and go live! Congratulations, you have a new project! But it has no files yet. As a quick way to create the first file, click the “README” link:
- Copy your files to the new Repository file: Copy everything in your working folder (
/Documents/my-site
) into your GitHub Repository folder (/Sites/[username].github.io
). - Scroll down the page until you find the Commit area, and click “Commit new file”. Every time you create a new version of a file, you are making a “commit” to record that in the file version history. Each commit has a message to describe the change.
- Type YOUR_USERNAME.github.io in the browser, and reload until your webpage appears. Github takes from 1-10 minutes to upload your project changes to the user-facing webpage URL, so you may need to exercise patience. You may also need to “hard reload” (hold shift while reloading), to clear the browser cache.
Whenever you want to make changes to your website, you just need to commit the changes and then push the files up to your GitHub repository. Your changes will be published automatically!
If you want to use your own domain you can do that too. We will talk about it in some other near future article.
Let me know if I missed any steps, if something didn’t work out quite right for you, or if this guide was helpful! Thank you for reading!
Happy Coding.
Leave a Reply