Skip to main content
Back to command reference
Remote Repositories

git remote

Manage connections to remote repositories

Practical example

bash
git remote -v
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)
git remote add upstream https://github.com/original/repo.git

Command overview & how it works

Remotes are shorthand names for URLs to hosted repositories. The default remote after cloning is 'origin', which points to the URL you cloned from. Use git remote -v to list all remotes with their fetch and push URLs (they can be different). Use git remote add <name> <url> to connect a new remote, git remote remove <name> to delete one, and git remote rename <old> <new> to rename. Use git remote set-url <name> <new-url> to change a remote's URL without removing and re-adding it. Use git remote show <name> to see detailed information about a remote's branches, tracking relationships, and whether it is reachable. Multiple remotes are common when working with forks — origin points to your fork, upstream points to the original repository.

Chapter 05 · Remotes & Collaboration

Master upstream tracking, SSH auth, and team workflows

Upstream sync strategies, merge vs rebase on pull, and semantic release tagging in the 97-page course — ₹499.

Learn more

Practical tips

  • Use git remote -v to see both fetch and push URLs — they can point to different addresses.
  • In a fork workflow, keep origin pointing at your fork and add the original project as upstream: git remote add upstream <url>.
  • Change a remote's URL with git remote set-url origin <new-url> instead of deleting and re-adding it.

Deep-dive guides & tutorials

In-depth walkthroughs and practical scenarios related to git remote

All guides →

Related commands

More from Remote Repositories