Rana Maninder Singh
Lesson 5 of 8Git & GitHub

GitHub Essentials — Remote Repos & Sharing

Lesson opener

In one line: Create a GitHub account and repository.

Why it matters: This shows up at work when you need to create a GitHub account and repository.

Before this lesson: Branching & merging

Before you start

ResourceLink
PreviousBranching & merging
NextPull requests & collaboration
Time~50 minutes

What you will learn

  • Create a GitHub account and repository
  • git remote, git push, git pull, git clone
  • SSH vs HTTPS authentication (2026 recommendation)
  • Write a README that gets you hired

Section 1 — Create GitHub account & repo

  1. Sign up: https://github.com/signup
  2. New repository → name my-portfolio → Public → do not add README if you already have local repo
  3. Copy the remote URL

Section 2 — Connect local repo to GitHub

cd my-first-repo
git remote add origin https://github.com/YOUR_USERNAME/my-portfolio.git
git push -u origin main

Expected: objects upload, branch main tracks origin/main.

Verify:

git remote -v

Section 3 — Clone someone else's repo

git clone https://github.com/octocat/Hello-World.git
cd Hello-World

Gets full history + default branch.


Section 4 — Push & pull daily workflow

git pull origin main    # get teammates' changes first
# edit files
git add .
git commit -m "Update analysis notebook"
git push origin main

Always pull before push on shared branches to avoid unnecessary merge commits.


Section 5 — SSH keys (recommended 2026)

HTTPS asks for password/token each time; SSH uses a key pair.

ssh-keygen -t ed25519 -C "you@example.com"
# Press Enter for default path
cat ~/.ssh/id_ed25519.pub

Copy output → GitHub → Settings → SSH and GPG keys → New SSH key

Test:

ssh -T git@github.com

Use SSH remote:

git remote set-url origin git@github.com:YOUR_USERNAME/my-portfolio.git

Section 6 — README that works

Structure:

Add screenshots for visual projects (mobile apps from android5).


Section 7 — Fork vs clone

ActionWhen
CloneYou have write access to repo
ForkCopy someone's repo to your GitHub — contribute via PR

Practice

  1. Push your git2 repo to GitHub
  2. Edit README on GitHub website (pencil icon) — pull locally
  3. Confirm git pull brings the web edit to your laptop

Checklist

  • [ ] Repo visible on GitHub
  • [ ] git push and git pull work
  • [ ] README explains project in under 30 seconds

Teacher walkthrough: remote backup

All figures illustrative.

Step 1 — Create empty remote (GitHub) without README if local already has commits (avoid divergent histories).

Step 2 — git remote add origin … then push -u as taught.

Step 3 — Clone elsewhere to prove backup works.

Step 4 — HTTPS/SSH auth set up before deadline panic.

Failure example: two unrelated roots

Symptom: Push rejected; messy pull of README-only remote.

Diagnosis: Created remote with README while local had history.

Correction: Prefer empty remote, or reconcile carefully once — then standard push flow.

Validation: git remote -v correct; clone on second folder works.

Guided practice

What does -u buy you on first push?

Complete solution: Sets upstream tracking so later git push / git pull know which remote branch to use.

Independent practice

Acceptance criteria:

Common mistakes

  1. Pasting PATs into screenshots/course answers.
  2. Forcing unrelated histories without understanding.
  3. Pushing secrets "just once".

What's next

Pull requests & collaboration — how teams actually ship code.