Clones & Remotes
Working with Remotes
A remote is a shared copy of the repo (usually on GitHub). origin is the conventional name for the main remote.
| Command | Does |
|---|---|
git clone <url> | Download a repo + its full history |
git remote -v | List remotes and their URLs |
git remote add origin <url> | Link a local repo to a remote |
$ git clone https://github.com/user/project.git
$ cd project
$ git remote -v
origin https://github.com/user/project.git (fetch)
origin https://github.com/user/project.git (push)
Analogy: origin is like the shared Google Doc everyone edits. Your local repo is your own copy; you sync it up and down with origin.
Note: Cloning downloads the entire history, not just the latest files - that's what makes Git distributed. Every clone is a full backup.