What is a Git remote?

A Git remote is a named reference to another repository's location, typically a URL, that lets your local repository push commits to and fetch commits from that repository.

Key Points: • git clone automatically creates a remote named origin pointing back to the repository you cloned from. • A repository can have multiple remotes, such as origin for your own fork and upstream for the original project you forked from. • git remote -v lists the configured remotes and their URLs for both fetch and push operations. • git remote add <name> <url> and git remote remove <name> let you manage which remotes your local repository knows about. • Remotes are just references; all the actual push, pull, and fetch commands specify which remote (and branch) to interact with.

Example: After forking a project on GitHub and cloning your fork, you'd add the original project as a second remote with git remote add upstream <url>, letting you fetch upstream's latest changes while still pushing your own work to origin.

Code Example:

git remote -v
git remote add upstream https://github.com/original/project.git

Interview Tip: A concise interview answer is:

"A remote is just a named reference to another repository's URL, most commonly origin for the repo you cloned from. You can have more than one, like adding an upstream remote when working with a fork, and every push, pull, or fetch command specifies which remote to talk to."