Getting Started with GitHub Pages
Getting Started with GitHub Pages
Learn how to create a free portfolio website using GitHub Pages and host your projects online with a custom domain. GitHub Pages is a fantastic way to showcase your work, and it's completely free.
What is GitHub Pages?
GitHub Pages is a static site hosting service from GitHub to hosts your websites directly from your GitHub repository. Just name, branch, and directory, and you're good to go!
Step-by-Step Setup
1. Create Your Repository
Create a new GitHub repository. For user or organization pages, the repository name should be your username (e.g., hasan2733.github.io). For project pages, you can name it anything.
2. Fork a Template or Use Your Existing Project
You can:
- Start with a boilerplate like HTML5 UP or Bootstrap
- Use your existing local project
- Fork this portfolio template
3. Push Your Files
Push your index.html, css/, js/, assets/ to your repository.
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/hasan2733/abid-portfolio.git
git push -u origin main
4. Enable GitHub Pages
- Go to your repository settings
- Scroll down to "Pages" section
- Select source:
mainbranch,/ (root) - Click save
GitHub Pages takes a minute to deploy. Your site will be available at https://username.github.io/repository-name.
Custom Domain
To use a custom domain:
- Buy a domain from a registrar
- In repository settings → Pages, enter your custom domain
- Configure DNS records at your registrar:
- For
CNAME: AddCNAMErecord pointing tousername.github.io - For
Arecords: Use GitHub's recommended IPs for apex domains
- For
Jekyll and Build Tools
GitHub Pages supports Jekyll by default, which allows you to add Markdown posts and compile SCSS. If you want to stick with plain HTML/CSS/JS, just commit those files directly.
Tips for Success
- Keep it lightweight - GitHub Pages has bandwidth limits, optimize images
- Use HTTPS - GitHub Pages provides free SSL certificates
- Add a
.nojekyllfile - If you have files/folders starting with_that shouldn't be processed by Jekyll - Use GitHub Actions - For custom build processes or to automate deployments
Conclusion
GitHub Pages is an excellent choice for personal portfolios, project showcases, and small websites. It's reliable, free, and integrates seamlessly with GitHub's ecosystem. With a bit of setup, your work can be live on the internet in minutes.
This is part of my ongoing learning journey in building robust, performant web experiences.
Further Reading: