
Host Your Website Free with GitHub Pages: Step-by-Step Guide (Part 18)
GitHub Pages turns a repository into a live website for free. Publish your portfolio, add a custom domain and understand the limits, step by step. Part 18 of our visual Git and GitHub series.
GitHub Pages is a free service that publishes the HTML, CSS and JavaScript files in a GitHub repository as a live website. Open your repository's Settings, choose Pages, select the main branch as the source and click Save. Within a few minutes your site is online at an address like username.github.io/project, with HTTPS included.
A small hospital in Vijayawada asked Sneha's studio for a quote, then asked a question that stopped her: "Can we see some of your earlier work?" Her best projects were private client sites, and her own portfolio existed only on GitHub as code. A recruiter or client cannot "see" code. That weekend she published her portfolio with GitHub Pages, and her next proposal included a live link. Your portfolio from Part 7 has been on GitHub since Part 9. In this Part 18 we turn it into a real website anyone can open on their phone, for free.
Your one-minute summary
- GitHub Pages hosts static websites (HTML, CSS, JavaScript) for free
- Turn it on in Settings → Pages; choose main and / (root)
- Your address: username.github.io/repository-name
- A repo named username.github.io becomes your main personal site
- You can connect a custom domain, with free HTTPS
- It does not run PHP or databases, and is not for online shops
What can GitHub Pages host?
GitHub Pages serves static files: what is in your repository is exactly what visitors receive. GitHub's documentation, About GitHub Pages, notes that it does not support server-side languages such as PHP, Ruby or Python.
Is GitHub Pages right for my site?
Great fit
- Personal portfolios and resumes
- Project and documentation sites
- Event, wedding or college club pages
- Landing pages and simple information sites
- Sites built with static generators
Not a fit
- PHP or WordPress sites
- Sites needing a database or user logins
- Online shops and payment flows
- Anything handling passwords or card numbers
- Commercial SaaS products
The bakery's booking system stays on regular hosting; Sneha's portfolio is perfect for Pages.
How do I publish my site with GitHub Pages?
Your repository needs an index.html in its main folder; that becomes the home page. Then:
Publishing in five clicks
From now on, every push to main updates the live site automatically.
Also readGitHub Actions for Beginners: Let GitHub Test and Deploy Your Website Automatically (Part 19)→What is the difference between a user site and a project site?
| User site | Project site | |
|---|---|---|
| Repository name | Exactly username.github.io | Any name, such as my-portfolio |
| Web address | https://username.github.io | https://username.github.io/my-portfolio |
| How many? | One per account | One per repository |
| Best for | Your main personal or portfolio site | Individual projects and demos |
What are the limits of GitHub Pages?
The limits are generous for personal sites. GitHub's documentation lists these usage limits:
GitHub Pages limits at a glance
Source: GitHub Pages limits. Pages is not intended as free hosting for online businesses or e-commerce.
Keep image sizes small (compress photos before committing) and you will rarely come close to these limits with a portfolio or small information site.
How do I use my own domain name?
You can point a domain you have bought, such as snehareddy.in, to your GitHub Pages site. HTTPS remains free.
Connecting a custom domain
GitHub also recommends verifying your domain in your account settings to prevent takeovers.
What are common GitHub Pages problems?
Problem and fix
404 page
- No index.html in the chosen folder
- Or it is called Index.html; names are case-sensitive
CSS or images missing
- Links like /style.css break on project sites
- Use relative paths: style.css, images/photo.jpg
Changes not showing
- Wait a minute and check the Actions tab
- Hard-refresh the browser
PHP shows as text
- Pages cannot run PHP
- Use regular hosting for PHP sites
From code to client proposal
Launch checklist
- index.html is in the repository's main folder
- All links and images use relative paths
- Images are compressed
- No API keys or private data in the repository
- Site tested on a phone and a laptop
- Live link added to your README and GitHub profile
Her View
For many students and first-time freelancers, paying for hosting feels like a hurdle before they have earned anything. GitHub Pages removes that hurdle. A live portfolio link on your CV or LinkedIn says "I build real things" more clearly than any certificate. Publish early, even if it is simple; you can improve it with every push.
Also readPull Requests on GitHub Explained: Propose, Review and Merge Changes (Part 14)→His Insight
Use GitHub Pages for what it does best: fast, free, static sites. Keep secrets out of public repositories, and use a proper host for anything with PHP, databases or payments. Because every push to main redeploys the site, the GitHub flow from Part 16 becomes your release process: branch, review, merge, and it is live.
H View Verdict
GitHub Pages is the easiest way to put a static website online for free, with HTTPS and optional custom domains. Your portfolio is now live. In Part 19, we let GitHub do routine jobs for you with GitHub Actions, including checks that run on every pull request.
Self-assessment: test yourself
Ready? Tap an option for each question. You will see right away whether you got it, with a short explanation, and your score at the end. Take your time, and try again as often as you like.
GitHub Pages quiz: 10 questions
1. Where do you turn on GitHub Pages?
- In VS Code
- Repository Settings, then Pages
- Your profile README
- The Issues tab
Pages is configured in the repository's settings.
2. Which file becomes your home page?
- README.md
- index.html
- .gitignore
- style.css
index.html in the chosen folder is served as the home page.
3. Can GitHub Pages run a PHP website?
- Yes, always
- Only with a paid plan
- No, it only serves static files
- Only on custom domains
GitHub Pages does not support server-side languages like PHP.
4. What repository name creates your main user site?
- website
- main
- username.github.io
- pages
A repository named username.github.io publishes to https://username.github.io.
5. What is the maximum size of a published GitHub Pages site?
- 100 MB
- 1 GB
- 10 GB
- Unlimited
GitHub's documentation says published sites may be no larger than 1 GB.
6. Your CSS loads locally but not on GitHub Pages. A likely cause is
- CSS is not allowed
- Absolute paths like /style.css on a project site
- Your internet is slow
- You need a paid plan
Use relative paths so files load from the project folder.
7. Is GitHub Pages suitable for an online shop taking payments?
- Yes
- No; GitHub says it is not for e-commerce
- Only during sales
- Only with HTTPS
Use proper hosting for commercial transactions.
8. After enabling Pages, how do you update the live site?
- Email GitHub
- Push new commits to the published branch
- Re-create the repository
- Upload a ZIP
Each push to main redeploys the site automatically.
9. What is the soft bandwidth limit per month?
- 1 GB
- 10 GB
- 100 GB
- 1 TB
GitHub lists a soft limit of 100 GB per month.
10. Can you use your own domain with GitHub Pages?
- No
- Yes, with DNS records and free HTTPS
- Only .com domains
- Only for organisations
Custom domains are supported, with HTTPS available for free.
Frequently asked questions
Is GitHub Pages really free?
Yes, for public repositories on the Free plan, including HTTPS. You only pay if you buy a custom domain or need Pages for private repositories on a paid plan.
Can I use GitHub Pages for a client's business website?
A simple information site is generally fine, but GitHub says Pages is not intended for online businesses, e-commerce or commercial transactions. Use regular hosting for shops and payment flows.
How long does an update take to go live?
Usually under a couple of minutes after you push. Check the Actions tab if it takes longer.
Can I host a React or Vue site?
Yes, after building it into static files. A GitHub Actions workflow can build and deploy it automatically on each push, which leads nicely into Part 19.
H View stories follow our editorial policy. Spotted an error? Tell us and we will correct it.
Rate this article
One tap is enough. No comment needed.
Was this article helpful?
Your answer goes straight to our editors.













Comments0
No comments yet. Start the conversation.