Sikau

Git & GitHub · Day 13 · about 25 min

GitHub and git push

Put your repository online.

Your laptop isn't a backup

Everything so far lives only on your computer. A remote is a copy of the repository somewhere else — usually GitHub — so it's backed up, shareable, and can even be published as a website.

remote add, push -u

git remote add origin https://github.com/you/cafe.git
git remote -v
git push
git push -u origin main
echo "<footer>Open daily</footer>" > footer.html
git add .
git commit -m "Add footer"
git push
git log --oneline
  • git push uploads commits — never uncommitted changes. Commit first.
  • On a real computer GitHub asks you to sign in the first time (a browser login or an SSH key).
  • Push often: an unpushed commit is only as safe as your laptop.

The rest of this lesson

  • Local and remote branchesexplain
  • What gets uploaded?predict
  • Ahead by how many?predict
  • Remote wordsmatch
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 18 lessons of Git & GitHub