Module 7

Git & GitHub: Pushing Your Site

~9 min listen · Written guide below

Your website looks great on your computer. But right now nobody else can see it. Time to change that.

What Is Git?

Git is version control — it keeps a history of every change you make. Think of it like Google Docs version history but for code. If you break something, you can always go back.

What Is GitHub?

GitHub is where your code lives online. If Git is version history, GitHub is Google Drive — it stores your files in the cloud. It's also what we'll use to host your website for free.

Step 1: Initialize Git

Navigate to your project folder and run:

git init

Git is now tracking this folder.

Step 2: Create a .gitignore

Create a .gitignore file for a static website project

This tells Git to ignore system files and editor files that don't belong in your repo.

Step 3: Stage Your Files

git add .

The dot means "everything." Check what's staged with git status.

Step 4: Make Your First Commit

git commit -m "Initial website build"

A commit is a snapshot. Your code is now saved in Git's history.

Step 5: Create a Repository on GitHub

  1. Go to github.com and log in
  2. Click the + button → New repository
  3. Name it (use hyphens, no spaces)
  4. Keep it Public (required for free GitHub Pages)
  5. Do NOT add a README, .gitignore, or license
  6. Click Create repository

Step 6: Connect and Push

Replace YOUR-USERNAME with your actual GitHub username:

git remote add origin https://github.com/YOUR-USERNAME/my-bakery-website.git
git branch -M main
git push -u origin main

GitHub may ask you to authenticate the first time. Log in when prompted.

Verify It's on GitHub

Refresh your GitHub repository page. You should see all your files listed. That's your code, living in the cloud. If your laptop dies tomorrow, your website is safe.

Common Errors

"fatal: remote origin already exists" — Remove and re-add:

git remote remove origin
git remote add origin https://github.com/YOUR-USERNAME/my-bakery-website.git

Authentication failed — Use the GitHub CLI:

gh auth login

"error: failed to push some refs" — Pull first:

git pull origin main --allow-unrelated-histories
git push -u origin main

Pro Tip: Let Claude Handle Git

Once you're comfortable, just tell Claude:

Commit all my changes with the message "Add menu section" and push to GitHub

Claude knows Git. It'll run the right commands for you.

Your code is on GitHub. Next step: turning it into a live website. That takes about two minutes.