LESSON 9

Remote Repositories

Learning objective: Connect a local repo to GitHub and push your code.

Understand

A remote links your local repo to GitHub.

Add a remote named origin pointing to your GitHub repo, then push your commits up. After that, git push sends new work and git pull brings down changes.

Analogy: Pushing is like uploading your latest save to the cloud.

See It in Action

Connecting and pushing:

git remote add origin https://github.com/you/repo.git
git push -u origin main
How it works: The first line links your local repo to GitHub, and the push uploads your commits to the main branch online.

Try It Yourself

  1. Create an empty repo on GitHub.
  2. Add it as origin.
  3. Push your local commits.

Quick Quiz

What does git push do?

Challenge

Push a local project to a new GitHub repository.

Success condition: Your commits appear in the repository on GitHub.