What are Remotes?
A remote is a copy of your repository hosted somewhere else — usually on a server like GitHub, GitLab, or Bitbucket. Remotes enable collaboration: they're how you share work and get updates from others.
The Collaboration Model
Your Machine GitHub Teammate's Machine
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Local │ push │ Remote │ pull │ Local │
│ Repo │ ──→ │ (origin)│ ←── │ Repo │
│ │ pull │ │ push │ │
│ │ ←── │ │ ──→ │ │
└──────────┘ └──────────┘ └──────────┘
Key Commands
git clone— Copy a remote repository to your machinegit remote— Manage connections to remote repositoriesgit push— Upload your commits to a remotegit pull— Download and merge remote changesgit fetch— Download remote changes without merging
Origin
When you clone a repository, Git automatically names the remote origin. This is just a convention — you can have multiple remotes with any names.
Remote Tracking Branches
When you fetch or pull, Git creates remote tracking branches like origin/main. These are read-only snapshots of where the remote's branches were last time you synced.
main → your local branch (you commit here)
origin/main → where origin's main was when you last fetched
Typical Workflow
git pull— Get latest changes from the team- Make your changes, commit locally
git push— Share your commits with the team
In the next lessons, you'll practice each step of this workflow.