git remote
Adding, renaming, and removing remotes.
A remote is nothing more than a named entry in .git/config: a short name like origin paired with a URL and a refspec. You can have as many remotes as you need — forked repos, upstream projects, staging servers, or mirrors all work the same way.
Manage Your Remotes
Add a remote, rename it, or remove it. Watch .git/config update in real time on the right.
The fork workflow
The most common reason to have two remotes is the open-source fork workflow. You have your own fork at origin and the authoritative upstream project at upstream.
You push to origin (your fork) and open pull requests from there. You fetch from upstream to keep your fork in sync with the project.
What the refspec does
The refspec in .git/config tells Git how to map remote branch names to local remote-tracking branch names:
The + means force-update (allow non-fast-forward updates to the remote-tracking refs). The * globs map every remote branch to a local origin/branch tracking ref. You can add custom refspecs to fetch only specific branches.