Build a Personal Portfolio Website in Just 1 Day — Step-by-Step Guide for Beginners

3.01K 0 0 0 0

📘 Chapter 6: Going Live — Hosting with GitHub Pages

🧭 What You’ll Learn

By the end of this chapter, you'll be able to:

  • Set up GitHub and create a repository for your portfolio
  • Upload your website files using GitHub's interface or Git
  • Enable GitHub Pages to host your site for free
  • Use a custom domain name (optional)
  • Troubleshoot common deployment issues
  • Maintain and update your site easily

🌐 Why GitHub Pages?

GitHub Pages is a free hosting service offered by GitHub that allows you to publish static websites (HTML, CSS, JS) directly from a GitHub repository.

Benefits of GitHub Pages

  • Free forever (even for custom domains)
  • Fast and reliable (hosted on GitHub’s global CDN)
  • HTTPS included by default
  • Easy integration with Git version control
  • Supports custom domains and Jekyll static site generators

🔧 Step-by-Step Guide to Deploy Your Portfolio with GitHub Pages


🛠️ Step 1: Set Up a GitHub Account

If you haven’t already:

  • Go to https://github.com
  • Click Sign Up and create your free account
  • Choose a username that matches your brand (e.g., alexsmith-dev)

📁 Step 2: Create a New Repository

  1. Click the "+" icon in the top-right > New repository
  2. Name it something relevant like portfolio or my-website
  3. Set the repository to Public
  4. Check the box to initialize with a README
  5. Click Create repository

📂 Step 3: Upload Your Website Files

You have two options:


🅰️ Upload via GitHub Web Interface (Easy)

  1. Click Add file > Upload files
  2. Drag and drop your website files (index.html, css, images, etc.)
  3. Commit the changes

🅱️ Upload Using Git (Command Line)

If you have Git installed locally:

bash

 

# Clone the repo

git clone https://github.com/yourusername/portfolio.git

 

# Move into the folder

cd portfolio

 

# Add your website files

cp -r ../local-website/* .

 

# Commit and push

git add .

git commit -m "Initial commit"

git push origin main


🚀 Step 4: Enable GitHub Pages

  1. Go to your repo's main page
  2. Click Settings > Pages (in the left menu)
  3. Under “Source”, choose:
    • Branch: main
    • Folder: / (root)
  4. Click Save

After a few seconds, you’ll see a confirmation message:

“Your site is published at https://yourusername.github.io/portfolio/”


🌍 Accessing Your Live Website

You can now visit your site via the URL:

text

 

https://yourusername.github.io/repository-name/

For example:

text

 

https://alexsmith.github.io/portfolio/


🧱 Optional: Deploy from /docs Folder

If your website files are inside a docs/ subfolder:

  • In the Pages settings, choose /docs as the source
  • Place your index.html inside docs/

This is useful if your main repo includes source code or other files.


🌐 Step 5: Add a Custom Domain (Optional)

Want a cleaner URL like www.alexsmith.dev?

🪜 How to Set It Up:

A. Buy a domain

Use providers like Namecheap, GoDaddy, or Google Domains.

B. Point DNS to GitHub

Set your DNS records:

Type

Name

Value

A

@

185.199.108.153 (and others)

CNAME

www

yourusername.github.io

C. Add a CNAME file in your repo root:

CNAME

 

www.yourcustomdomain.com

D. Enforce HTTPS

  1. Go to Settings > Pages
  2. Check "Enforce HTTPS"

GitHub will provision an SSL certificate automatically (can take up to 24 hours).


📊 Table: Deployment Checklist

Task

Done

GitHub account created

Repository initialized

Website files uploaded

GitHub Pages enabled

Site verified live

Custom domain linked (opt.)

HTTPS enforced


🧪 Testing Your Site

After publishing:

  • Open the link on multiple devices
  • Click every navigation link and button
  • Test form submissions if included
  • Use Lighthouse or GTmetrix to analyze speed and performance

🧰 Updating Your Site

Every time you make changes:

  1. Edit your files locally
  2. Commit and push to GitHub:

bash

 

git add .

git commit -m "Updated About section"

git push origin main

  1. GitHub Pages will auto-update your live site within seconds.

Common Deployment Errors & Fixes

Issue

Cause

Solution

404 Not Found

No index.html in root

Ensure index.html is at root or /docs

CSS not loading

Incorrect path

Use relative paths like ./css/style.css

Broken images

Misspelled filenames or wrong paths

Match case and check folder names

No HTTPS

HTTPS not enforced

Check “Enforce HTTPS” under Pages settings

Domain not resolving

DNS propagation delay

Wait 1–24 hours; check DNS settings


🧠 Advanced Tips

  • Create a single-page site for easier maintenance
  • Use a separate gh-pages branch for deployment (optional)
  • Add a 404.html file to handle broken links gracefully
  • Use GitHub Actions to deploy from build output (React, Vue, Jekyll)

🔁 Sample Deployment Automation (GitHub Actions)

For advanced users building with React or another framework:

yaml

 

name: Deploy

 

on:

  push:

    branches:

      - main

 

jobs:

  deploy:

    runs-on: ubuntu-latest

    steps:

      - uses: actions/checkout@v3

      - run: npm install && npm run build

      - run: git add build -f

      - run: git commit -m "Deploy"

      - run: git push origin `main`


📌 Summary

GitHub Pages offers a simple and free way to host your portfolio.

You’ve now learned how to:

  • Set up and organize a GitHub repository
  • Upload your portfolio files
  • Enable GitHub Pages hosting
  • Access and share your live website
  • Customize your domain and troubleshoot errors


Your site is now online, professional, and accessible to the world!

Back

FAQs


❓1. Can I really build a complete portfolio website in just one day?

Answer:
Yes! With the right structure, pre-written content, and a simple template, you can absolutely build and launch a functional personal portfolio site in 6–8 hours.

❓2. Do I need to know how to code to build a portfolio site?

Answer:
Not necessarily. You can use free HTML templates and just customize the text and images. But basic knowledge of HTML and CSS will help you make edits and personalize it further.

❓3. What sections should I include in my portfolio?

Answer:
A simple portfolio should include:

  • A homepage
  • About section
  • Skills or services
  • Projects or work samples
  • Contact info (or a form)

❓4. Where can I find free templates to speed up the process?

Answer:
You can find high-quality templates on sites like HTML5 UP, BootstrapMade, Templatemo, or search GitHub for “portfolio template.”

❓5. How do I host my website for free?

Answer:
You can use GitHub Pages—it’s completely free and perfect for static websites. Simply upload your HTML/CSS files to a public GitHub repository and enable Pages in the settings.

❓6. Can I use my own domain name with a free portfolio site?

Answer:
Yes! You can register a domain from providers like Namecheap or GoDaddy and point it to your GitHub Pages site using a CNAME file and DNS settings.

❓7. What tools or software do I need to build the site?

Answer:
At minimum, you’ll need:

  • A text editor (like VS Code)
  • A browser for previewing
  • Optional: GitHub for hosting


You won’t need any paid software.

❓8. Should I include my resume on the portfolio site?

Answer:
Yes, it’s a good idea to include a downloadable PDF version of your resume or link to it via Google Drive. It makes it easier for recruiters to access.

❓9. How can I make my portfolio stand out visually?

Answer:
Use clean design, modern fonts (like Google Fonts), high-quality images, and consistent spacing. You don’t need fancy animations—clarity and simplicity win.

❓10. What should I do after my site is live?

Answer:

  • Share it on LinkedIn, Twitter, and in your email signature
  • Add it to your resume
  • Keep updating it with new projects
  • Ask for feedback from peers or mentors