LearnAI ToolsCareerPractice BuildsPlayDevelopmentContact
Git & GitHubBeginner~1 hour

Publish a Portfolio with GitHub Pages

Create a repository, push a small portfolio website and publish it for free at your-username.github.io, then ship an update through a pull request.

RepositoriesPushGitHub PagesPull Requests

Overview

GitHub Pages turns a repository into a live website, for free, straight from your Git history. In this project you will build a small portfolio page, publish it at https://your-username.github.io, and then update it the professional way — on a branch, through a pull request — watching the live site change after the merge.

You will finish with something genuinely useful: a public portfolio you can put on your CV, built and maintained with exactly the workflow employers use.

What You'll Build
  • A small, responsive portfolio page (index.html and style.css) with a README.
  • A GitHub repository named your-username.github.io, which GitHub publishes automatically.
  • An update delivered through a feature branch and a merged pull request.

Prerequisites

  • Git installed and configured — lesson 2.
  • A free GitHub account, with HTTPS or SSH authentication set up — lessons 10 and 11.
  • The everyday commands: add, commit, push and pull — lessons 3 and 10.
  • Branches and pull requests — lessons 7 and 12.
Use Your Own Username

The examples use the username priya-sharma. Replace it with your own GitHub username everywhere — the repository name must match your username exactly for GitHub to publish it at your-username.github.io.

Step 1: Create the Website

Create a folder named after your future site and turn it into a repository:

mkdir priya-sharma.github.io
cd priya-sharma.github.io
git init
Output

Click Run to see what this code prints.

Add three files. Change the text to describe yourself:

index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Priya Sharma | Web Developer</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Priya Sharma</h1>
<p>Aspiring web developer. I build small, fast, accessible websites.</p>
</header>
<main>
<h2>About me</h2>
<p>I'm learning HTML, CSS, JavaScript and Git, one project at a time.</p>
</main>
<footer>
<a href="https://github.com/priya-sharma">GitHub</a>
</footer>
</body>
</html>
style.css
body {
font-family: system-ui, sans-serif;
max-width: 720px;
margin: 40px auto;
padding: 0 16px;
line-height: 1.6;
}
header h1 {
margin-bottom: 0;
}
README.md
# priya-sharma.github.io
My personal portfolio, published with GitHub Pages.

Step 2: Commit It

git status --short
Output

Click Run to see what this code prints.

git add .
git commit -m "Create portfolio home page"
Output

Click Run to see what this code prints.

Step 3: Create the GitHub Repository

  1. On GitHub, click + → New repository.
  2. Name it exactly your-username.github.io (for example priya-sharma.github.io).
  3. Choose Public — GitHub Pages on the free plan publishes from public repositories.
  4. Leave README, .gitignore and licence unticked, because your local repository already has a commit.
  5. Click Create repository.

Step 4: Push and Publish

git remote add origin https://github.com/priya-sharma/priya-sharma.github.io.git
git push -u origin main
Output

Click Run to see what this code prints.

For a repository named your-username.github.io, GitHub publishes the main branch automatically. Open the repository’s Settings → Pages to confirm the source is “Deploy from a branch” with main and the / (root) folder. After a minute or two, your site is live at https://priya-sharma.github.io — the Actions tab shows the deployment while it runs.

Step 5: Update Through a Pull Request

Now add a Projects section the way a team would — on a branch:

git switch -c add-projects-section
Output

Click Run to see what this code prints.

Add this inside <main>, after the About section:

index.html (new section)
<h2>Projects</h2>
<ul>
<li><a href="https://github.com/priya-sharma/weather-dashboard">Weather dashboard</a></li>
<li><a href="https://github.com/priya-sharma/recipe-finder">Recipe finder</a></li>
</ul>
git diff --stat
git commit -am "Add projects section"
git push -u origin add-projects-section
Output

Click Run to see what this code prints.

On GitHub, click “Compare & pull request”, check that the base is main, describe the change and create the pull request. Review your own Files changed tab, then click “Merge pull request” and “Delete branch”. GitHub redeploys the site automatically — refresh it after a minute to see the new section.

Step 6: Sync and Clean Up

git switch main
git pull
Output

Click Run to see what this code prints.

git branch -d add-projects-section
git fetch --prune
git log --oneline --graph
Output

Click Run to see what this code prints.

The graph tells the whole story: the first commit, the feature branch and the merge commit GitHub created when you merged the pull request.

Extend This Project

  • Add a projects page per project, with screenshots and links to each repository.
  • Connect a custom domain under Settings → Pages (you will need to add DNS records with your domain provider).
  • Add a dark mode with a prefers-color-scheme media query, delivered through another pull request.
  • Create a special repository named exactly like your username (priya-sharma/priya-sharma) with a README.md — GitHub shows it on your profile page.

Summary

You created a repository, published it as a live website with GitHub Pages, and shipped an update through a branch and a pull request. From now on, every change to your portfolio can follow the same safe, reviewable path.