Remotes: the shared copy on the server
A remote is a version of your repository that lives somewhere else — usually on a server like Sangam-Git — that you and your team sync with. It's the common meeting point for everyone's work.
Remember that a repo on your laptop is your copy (see clone). Your teammate in Chennai has their copy. How do these copies share work? Through a remote: a shared repository on a server that everyone pushes to and pulls from.
origin: the default remote
When you clone a repo, Git automatically saves the server's address under a nickname: origin. So instead of typing the full URL every time, you just say origin.
See your remotes:
git remote -v
origin https://sangam.example.com/acme/payments.git (fetch)
origin https://sangam.example.com/acme/payments.git (push)
origin is just a name — nothing magic about it. It's the label for "the team's copy on Sangam-Git."
How work flows
Here's the whole picture with three copies of one project:
Priya's laptop ──push──► ┌─────────────┐ ◄──push── Arjun's laptop
(local repo) ◄──pull── │ origin │ ──pull──► (local repo)
│ (Sangam-Git)│
└─────────────┘
Nobody edits origin directly. Everyone works locally, then:
- pushes their commits up to
originto share them, and - pulls others' commits down from
originto stay up to date.
Adding a remote yourself
If you started a repo with git init (no clone), there's no remote yet. You add one after creating an empty repo on Sangam-Git:
git remote add origin https://sangam.example.com/acme/payments.git
git push -u origin main
The first line teaches your local repo where the server is. The second sends your main branch up for the first time. (The -u links them so future pushes are just git push.)
More than one remote
Usually you only have origin. But you can have several — for example, if you're migrating from GitHub to Sangam-Git, you might briefly have both:
git remote add sangam https://sangam.example.com/acme/payments.git
Now git push sangam main sends to Sangam-Git and git push origin main still goes to the old host. Once you've fully moved, you drop the old one.
In one line: a remote is the shared copy.
originis its usual name. Push sends work to it; pull brings work from it. That's push and pull, next.