If you want free hosting for a static site and you like simplicity with a hint of magic then GitHub Pages is the place to be. This guide walks you through hosting HTML CSS and JavaScript without drama and with a few sarcastic asides for flavor. You will learn how to create a repo add your files push changes enable Pages and optionally point a custom domain so your site looks professional and not like a local file dump.
Click New repository on GitHub and pick public if you want free hosting. For a user site name the repo exactly username.github.io where username matches your account. Project sites can use any name and will be served under username.github.io/repo. Naming matters unless you enjoy confusion.
Drop an index.html in the repo root and organize styles and scripts how you like. A single index.html in the root becomes your homepage. Keep paths tidy so the browser does not need to play detective.
Use the web upload or a local git workflow. A minimal sequence looks like this
git init
git add .
git commit -m 'Initial commit'
# add the remote URL from the new repo page
git remote add origin https://github.com/USERNAME/REPO.git
git push -u origin main
If you prefer a gh pages branch for a project site create and push that branch instead. The commands remain the same except replace main with gh-pages where appropriate.
Open the repository settings and find Pages. Choose a publishing source such as the main branch and the root folder. Save and be patient while GitHub builds your site. If the page fails to publish check the build logs in the settings to see what went wrong. The logs will tell you if a missing index.html or a bad asset path caused the outage.
Project sites commonly use the gh-pages branch or the main branch. User and organization sites publish from the special username.github.io repository root. Choosing the wrong branch is a classic mistake and leads to serving the wrong folder or an embarrassing 404.
To use a custom domain add a CNAME file to the repo with your domain name or enter the domain in the Pages settings. Then configure your DNS provider to point the domain to GitHub Pages. DNS changes can take a while so pour a coffee and wait.
Once DNS propagates GitHub will attempt to provision a TLS certificate and serve your site over HTTPS. That may add a short delay but it is worth it for secure cookies and fewer worried visitors.
There you go. You now have a predictable deployment path for static sites using GitHub Pages. It is reliable affordable and shockingly easy to update. Push changes and your site will refresh like clockwork unless you break something dramatic. Then you have version history to fall back on and the satisfaction of reverting your mistake like the responsible developer you pretend to be.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.