Chapter 18: Git GitHub Getting Started

Git + GitHub – Getting Started from absolute zero (2026 edition)

This is the exact path most people follow when they really start using Git & GitHub for the first time (not just watching tutorials).

We will go very slowly, command by command, with real outputs, explanations of why we do each step, what can go wrong, and what you actually see on screen. By the end you will have:

  • Git installed & configured
  • Your first local repository
  • Several commits
  • A branch + merge
  • Everything pushed to GitHub
  • A clean daily workflow you can repeat forever

Ready? Let’s begin.

Phase 1 – Prerequisites (do this first – 5 minutes)

  1. Check if Git is installed

    Open terminal / Git Bash / PowerShell / Command Prompt:

    Bash

    You should see something like:

    text

    If not → install it now. On Windows choose Git from Git Bash and Command Prompt during install.

  2. Set your identity (appears on every commit – do once per computer)

    Bash
  3. Modern defaults (very important in 2026)

    Bash

    Quick check:

    Bash

    You should see your name, email, and init.defaultBranch=main.

Phase 2 – Create Your First Local Repository (no internet yet)

Bash

You see:

text

→ A hidden .git/ folder appeared — that’s your entire version history.

Phase 3 – First commits (the sacred cycle)

  1. Create first file

    Bash
  2. See what’s happening (most important command!)

    Bash

    Output:

    text
  3. Stage the file (prepare for snapshot)

    Bash
    Bash
    text
  4. Commit (take the snapshot!)

    Bash

    Output:

    text

    🎉 First commit done!

  5. Make more realistic changes

    Edit README.md (add lines):

    text

    Then:

    Bash
  6. See your history

    Bash
    text

Phase 4 – Create a branch & merge (safety net)

Bash

Now edit README.md again:

text
Bash

Switch back:

Bash

→ The new line disappears! (safe)

Merge when ready:

Bash

Clean up:

Bash

Now:

Bash
text

Phase 5 – Connect to GitHub & push (make it live!)

  1. Go to github.com → log in → + → New repository

    • Name: my-first-github-project
    • Keep public (for learning)
    • Do NOT check “Add a README file” or anything else
    • Create repository
  2. Copy the commands GitHub shows you (they look like this):

    Bash

    Paste them one by one.

    First time → browser login or Personal Access Token (GitHub will guide you).

  3. Refresh the GitHub page → your README & commit history are now online! 🌐

From now on you just do:

Bash

Phase 6 – Your First Real Daily Workflow (memorize this)

Morning / after break:

Bash

New work:

Bash

→ Go to GitHub → create Pull Request → wait for review/merge

After merge:

Bash

Quick Troubleshooting Table (common first-day issues)

Problem Fix / Check
git push asks password every time Use Personal Access Token or Git Credential Manager
“src refspec main does not match” You forgot git branch -M main or repo is empty
Merge conflict after pull Edit conflicted files → git add → git commit
Git Bash opens in wrong folder Set Windows env var HOME = D:\Code
Nothing happens after git push Check GitHub page — sometimes needs refresh

You did it! You now have a real Git + GitHub repository with commits, branches, merge, and remote sync.

Next class?

  • How to handle real merge conflicts?
  • Create your first Pull Request live?
  • Add .gitignore + conventional commits?
  • Or fix any error you hit during this?

Just tell me what felt tricky or what you want to practice next — we’ll continue together. You’re officially “getting started” now — very proud of you! 🚀

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *