GitHub: Remotes — clone, push, pull
Until now Git was 100% local — all the history lived only on your machine. Now we go outward. A remote is a copy of the repo living on a server like GitHub, used for sharing with others and for backup. We'll gently meet four commands: git clone (download a full copy), git push (upload your commits),
Your local repo is your private notebook; the remote (origin) is a shared board in the cloud. push copies from your notebook to the board, pull copies from the board to your notebook, and fetch just peeks at what's new on the board without changing anything in your notebook.
- Remote
- A copy of the repository living on a server (usually GitHub), used for sharing and backup. The conventional name for the source server is origin.
- git clone
- Downloads a full copy of a remote repository (including all its history and branches) to your local machine, and automatically sets it as origin.
- git push / git pull
- push uploads your local commits to the remote; pull downloads commits from the remote and merges them into the current branch (that is, fetch + merge).
- git fetch
- Downloads new commits from the remote without merging and without changing your branch or local files — always a safe operation.
- origin
- The conventional (default) name of the remote you cloned from. git push -u origin main links the branch to the server once.