Tour of Git
Working with Remotes / Lesson 4.3

git remote — Managing Remotes

The git remote command lets you manage connections to remote repositories. You can add, remove, and list remotes.

Common Commands

  • git remote — List remote names
  • git remote -v — List remotes with URLs (verbose)
  • git remote add <name> <url> — Add a new remote
  • git remote remove <name> — Remove a remote

Multiple Remotes

You can have more than one remote. A common pattern:

  • origin — Your fork on GitHub
  • upstream — The original repository you forked from
git remote add upstream https://github.com/original/repo.git

Try it!

Set up a repository with multiple remotes:

  1. The repo already has origin. Check it: git remote -v
  2. Add an upstream remote: git remote add upstream https://github.com/original/project.git
  3. Verify both remotes: git remote -v

You should see both origin and upstream listed.

When to Use Multiple Remotes

  • Forking workflow: origin is your fork, upstream is the original
  • Deploy targets: origin for GitHub, production for your server
  • Team collaboration: Different remotes for different team repos
🎯

Goal

Add an 'upstream' remote and verify both remotes are configured

Terminal
$

No commits yet. Run `git init` and create your first commit.