Command Reference

git remote Tutorial

Explains how git remote lists, adds, renames, and removes remote definitions, and how origin fits into common collaboration flows.

Who This Is For
  • Developers who already know basic commit and branch actions
  • Readers who want to understand command boundaries and risk
Prerequisites
  • A basic mental model of worktree, index, and commits
  • Comfort reading `git status` and a small commit graph
Common Risks
  • Using local cleanup commands on already shared history
  • Continuing to rewrite before confirming a recovery path

The short version

git remote manages your named remote repository definitions.

Common forms

git remote -v
git remote add origin https://example.com/repo.git
git remote rename origin upstream
git remote remove upstream

What problem this command solves in a workflow

git remote is about managing the named remote repository definitions stored in your local repository. It controls which remotes exist, what their URLs are, and how they are named — but it does not communicate with remote servers by itself.

Typical use cases

  • Use git remote to view, add, rename, or remove remote definitions when setting up or reorganizing your repository's remote connections.
  • Put git remote into your collaboration flow so the team can manage fork-based workflows (origin vs upstream) and remote URL changes cleanly.
  • Use git remote in automation or setup scripts to configure remote definitions consistently across machines and environments.

Diagram view

Remote definition managementThe remote command manages named remote definitions stored locally — it does not communicate with remote servers directly. Add, rename, remove, and inspect remote URLs here.
Local config
Existing remotesNew remote URLsRemote names
Results
Remote listAdd/rename/remove results
remote manages the remote definitions recorded in your local repository — it does not directly communicate with remote servers.

Special cases and boundaries

  • The most common remote-workflow mistake is treating "download", "integrate", and "publish" as the same action. Split them first, then choose flags.
  • If the result may affect shared branches or externally visible history, double-check the remote, the target ref, and the permission boundary before executing git remote operations.
  • Looking at git fetch, git push, and git branch -vv together usually makes it easier to tell whether the problem is sync, auth, or ref selection.