Overview
GitHub Pages is a free static site hosting service that deploys directly from a GitHub repository. It’s perfect if you’re already using GitHub for version control.GitHub Pages is completely free for public repositories with unlimited bandwidth.
Prerequisites
- A GitHub account (create one at github.com)
- Your portfolio template folder ready to upload
- Basic familiarity with GitHub (helpful but not required)
Deployment Steps
Create a GitHub Repository
- Log in to GitHub
- Click the + icon in the top-right corner
- Select New repository
- Name your repository (e.g.,
my-portfolio) - Choose Public visibility
- Do NOT initialize with README, .gitignore, or license
- Click Create repository
Upload Your Portfolio Files
Enable GitHub Pages
- In your repository, click Settings (top navigation)
- Scroll down and click Pages in the left sidebar
- Under Source, select Deploy from a branch
- Under Branch, select
main(ormaster) and folder/ (root) - Click Save
You’ll see a message: “Your site is ready to be published at
https://username.github.io/repository-name/”Updating Your Portfolio
To make changes after deployment:Upload Changes
Via Web Interface:
- Navigate to the file in your repository
- Click the pencil icon (Edit)
- Make changes and commit
Custom Domain Setup (Optional)
Configure DNS Records
In your domain registrar’s DNS settings, add these records:For apex domain (example.com):For subdomain (www.example.com):
Configure GitHub Pages
- Go to repository Settings > Pages
- Under Custom domain, enter your domain (e.g.,
www.example.com) - Click Save
- Wait for DNS check to complete
- Enable Enforce HTTPS (recommended)
Troubleshooting
Site Not Loading
Check file structure
Check file structure
Ensure
index.html is at the root level of your repository, not in a subfolder.Verify GitHub Pages is enabled
Verify GitHub Pages is enabled
Go to Settings > Pages and confirm the source branch is set correctly.
Check for build errors
Check for build errors
Look at the Actions tab in your repository for deployment logs.
CSS/Images Not Loading
Use relative paths
Use relative paths
Change absolute paths like
/css/style.css to relative paths like css/style.css or ./css/style.css.Check file names
Check file names
Ensure file names match exactly (case-sensitive on GitHub Pages).
Best Practices
GitHub Pages has a soft bandwidth limit of 100GB/month and 10 builds/hour. This is more than sufficient for personal portfolios.
Next Steps
Custom Domain
Follow the custom domain setup guide above to use your own domain name.
SEO Optimization
Add meta tags and optimize your portfolio for search engines.