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
| Resource | Link |
|---|---|
| Previous | Branching & merging |
| Next | Pull 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
- Sign up: https://github.com/signup
- New repository → name
my-portfolio→ Public → do not add README if you already have local repo - 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 mainExpected: objects upload, branch main tracks origin/main.
Verify:
git remote -vSection 3 — Clone someone else's repo
git clone https://github.com/octocat/Hello-World.git
cd Hello-WorldGets 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 mainAlways 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.pubCopy output → GitHub → Settings → SSH and GPG keys → New SSH key
Test:
ssh -T git@github.comUse SSH remote:
git remote set-url origin git@github.com:YOUR_USERNAME/my-portfolio.gitSection 6 — README that works
Structure:
# Project Name— title- One sentence: what this does and for whom
## Setup— install commands## Usage— example with expected output## License— MIT or your choice
Add screenshots for visual projects (mobile apps from android5).
Section 7 — Fork vs clone
| Action | When |
|---|---|
| Clone | You have write access to repo |
| Fork | Copy someone's repo to your GitHub — contribute via PR |
Practice
- Push your git2 repo to GitHub
- Edit README on GitHub website (pencil icon) — pull locally
- Confirm
git pullbrings the web edit to your laptop
Checklist
- [ ] Repo visible on GitHub
- [ ]
git pushandgit pullwork - [ ] 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:
- Remote configured; push succeeds.
- Repo visible on the host.
- Clone test or second-machine pull documented.
- Auth method noted (HTTPS/SSH) without pasting secrets.
Common mistakes
- Pasting PATs into screenshots/course answers.
- Forcing unrelated histories without understanding.
- Pushing secrets "just once".
What's next
Pull requests & collaboration — how teams actually ship code.