Adding a Remote
What
Registering an external repository in Git requires adding a remote. This tells your local Git client where the remote repository resides and assigns it a short, convenient nickname.
How
You add a remote using the git remote add command, specifying a nickname and the address (URI) of the remote repository:
# General Syntax
git remote add <name> <uri>
# Example: Adding a local folder as a remote sibling
git remote add origin ../parent-project-folder
# Example: Adding a cloud-hosted Git repository
git remote add origin https://github.com/username/project.git
Note: By industry convention, the primary, shared authoritative source of truth for your team’s code is given the nickname origin.
To review all registered remotes in your repository:
# View list of registered remotes and their URIs
git remote -v
Why
Writing out long URIs or SSH paths every time you want to pull or push code is highly inefficient and prone to typos. Assigning a permanent, short nickname like origin lets Git handle address resolution in the background, keeping your commands simple, portable, and clean.
Summary
Use git remote add <nickname> <uri> to link your local workspace to an external repository, mapping it to a developer-friendly name like origin.