Paths/DevOps Engineer/Git / Remotes & GitHub
Connect to a Remote
Local commits are only half the story. Add GitHub as a remote and push your branch. In this lab the push is simulated — the workflow is identical to the real thing.
Validator
IDLE — checks run live as you type commands; submit when done
01Requirements
live checks- Remote 'origin' points at a github.com URL○
- Branch pushed to the remote○
02Walkthrough
10 steps- 01
Recreate the repository
Every lab starts from a fresh shell — ~/project doesn't exist yet. mkdir makes it.
mkdir ~/project - 02
Enter the repository
Remotes are stored per repository inside .git/config.
cd ~/project - 03
Initialize with one commit
A push needs committed work. git init, then give the repository a base commit.
git init - 04
Create a file to push
A README is enough — the point of this lab is the remote, not the content.
touch README.md - 05
Stage and commit
Stage everything, then record the 'init' commit on main.
git add . - 06
Commit
Now there is a commit on main that the later push will upload.
git commit -m "init" - 07
Add the remote
git remote add origin <url> stores the URL under the name 'origin' — the conventional name for the repository you cloned from or push to. On GitHub, create an empty repo first and copy its URL.
git remote add origin https://github.com/learner/demo.git - 08
Verify the remote
git remote -v lists every remote with its fetch and push URLs. Both should show your github.com URL.
git remote -v - 09
Push
git push uploads committed work. -u sets upstream tracking so future pushes can be a bare 'git push'.
git push -u origin main - 10
Submit for validation
The validator checks that origin points at github.com.
03Stuck?
0 of 3 revealedTake a hint without losing the lab — each one points at the thing to look at, not at the answer.
04AI Tutor
guides, never solvesTell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?
04Notebook
saved locally in this browserlearner@lab — ubuntu:24.04 + git
Session is disposable
↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list