How to Manage Remote Repositories in Git (git remote)
git remote manages the set of remote repository URLs your local repository knows about, most commonly a single "origin".
Published September 28, 2026
git remote lists and manages the remote repositories your local repo knows about, such as origin on GitHub.
How it works
Each remote is a name plus a URL. You can have several, for example origin and upstream when working with forks.
Use -v to see URLs.
Try it
git remote -v
origin git@github.com:me/app.git (fetch)
origin git@github.com:me/app.git (push)
Practical examples
Add a remote
git remote add upstream https://github.com/org/app.gitChange a URL
git remote set-url origin git@github.com:me/new.gitRemove
git remote remove upstreamRename
git remote rename origin githubCommon mistakes
- Pushing to the wrong remote.
- Forgetting to fetch the upstream of a fork.
- Leaving credentials in the URL.
Key takeaways
- remotes = named URLs.
- origin is the default name.
- Forks use origin plus upstream.
FAQ
How do I switch HTTPS to SSH?
git remote set-url origin <ssh-url>.
How do I see more details?
git remote show origin.