✕ Close
← Branches

Level 7 · Lesson 56: GitHub and git push

Secrets stay home →
INTRODUCTION
GitHub
A copy of your project, online.
GitHub is a real website. Ask a grown-up before you make an account.
press Enter ↵
💾 Save points on main
  1. Big title7a63fb7mainbig-titleyou are here
  2. Dark mode31d2355dark-mode
  3. Add a to-do listf02c54d
  4. Add my ideasadc97b5
  5. My About Me page8fa9095
✓ Everything is saved.

Windows PowerShell (practice mode: nothing here touches your real computer)

 

Lesson 56: GitHub and git push

Level 7, Save Points: Git and GitHub. Send your save points to a pretend GitHub. The new word: push. It follows lesson 55, Branches. Next comes lesson 57, Secrets stay home.

What the lesson explains

GitHub. A copy of your project, online. GitHub is a real website. Ask a grown-up before you make an account.

A copy online. Here we use a pretend GitHub: nothing leaves your browser. remote online copy; origin its nickname; push send it up.

What you do first

Connect to GitHub. In the practice terminal, type git remote add origin https://github.com/you/my-site.git at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>.

The files on the practice computer

This lesson works in one folder. At the start, Documents\my-site holds images\, ideas.txt, index.html, style.css, todo.txt.

Along the way you type git remote add origin https://github.com/you/my-site.git, type git remote -v, type git push -u origin main, type echo "A page about space" >> ideas.txt, type git add ideas.txt, type git commit -m "More ideas", type git push, type echo "Make a games page" >> todo.txt, type git add todo.txt and type git commit -m "Update my to-do list". Lesson 57 opens with the files just as you leave them.

What you practise

Try it, "Connect to GitHub": In the practice terminal, type git remote add origin https://github.com/you/my-site.git at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>. Then: In the practice terminal, type git remote -v at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: origin https://github.com/you/my-site.git (fetch) / origin https://github.com/you/my-site.git (push).

Try it, "Push!": In the practice terminal, type git push -u origin main at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: To https://github.com/you/my-site.git / * [new branch] main -> main / branch 'main' set up to track 'origin/main'. / (Pretend GitHub: on a real computer, your save points are now on the website too.). Then: In the practice terminal, type git status at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: On branch main / Your branch is up to date with 'origin/main'. / nothing to commit, working tree clean.

Try it, "Save, then send": In the practice terminal, type echo "A page about space" >> ideas.txt at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>. Then: In the practice terminal, type git add ideas.txt at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>. Then: In the practice terminal, type git commit -m "More ideas" at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: [main 76fefe3] More ideas / 1 file changed. Then: In the practice terminal, type git status at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: On branch main / Your branch is ahead of 'origin/main' by 1 commit. / (use "git push" to publish your local commits) / nothing to commit, working tree clean. Then: In the practice terminal, type git push at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: To https://github.com/you/my-site.git / 7a63fb7..76fefe3 main -> main / (Pretend GitHub: on a real computer, your save points are now on the website too.).

In your head, "Safe and sound": Your laptop breaks. Where is your project still safe? The answer: "On GitHub".

Challenge, "Change and push": Change todo.txt, save it, and push it to GitHub. Starting at PS C:\Users\you\Documents\my-site>, one way takes 4 commands: echo "Make a games page" >> todo.txt; git add todo.txt; git commit -m "Update my to-do list"; git push (par: 4).

What PlayBuddy and PlayType say

PlayType: "GitHub keeps a copy of your project online, safe and sound."

PlayBuddy: "Git push sends your project up to GitHub."

Help in every lesson

Everything happens on a pretend computer in your browser, so nothing touches your real files. PlayBuddy and PlayType stand beside the board, cheer you on and say when it is your turn.

A green ring shows where to click the first time. After that you do it on your own, and if you slip twice the ring comes back.

Stars

The lesson has 11 things to do. Up to one slip in ten gives three stars, up to one in four gives two, and finishing always gives at least one. Stars and progress are saved in this browser only; there is no account.

About DayOneCode

DayOneCode is an independent learning site, not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.