Git & GitHub Interview Question #29

What is a remote in Git?

Remotes, Fetch, Pull, Push, Merge, Conflicts, Rebase & Stash Junior Beginner

Quick Interview Answer

A remote is a named reference to another repository location, commonly hosted on GitHub or another Git server. It stores connection information that Git uses for operations such as fetch and push.

Detailed Explanation

A remote is a named reference to another repository location, commonly hosted on GitHub or another Git server. It stores connection information that Git uses for operations such as fetch and push.

A cloned repository commonly has a remote named origin. A project can have multiple remotes, for example origin for a personal fork and upstream for the original repository.

Code Example

git remote -v

git remote add origin https://github.com/username/project.git