List of remotes for a Git repository?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
To see the remotes configured for a Git repository, use git remote or git remote -v. The first shows remote names, and the second shows the fetch and push URLs associated with those names.
The Fastest Commands
To list just the remote names:
Typical output:
To see the URLs too:
Typical output:
For most everyday work, git remote -v is the practical answer.
What a Remote Actually Is
A remote is a named reference to another Git repository. The name is local to your repository clone.
Common conventions:
- '
originfor the main remote you cloned from' - '
upstreamfor the original project when you work from a fork' - '
backupor other custom names for mirrors or secondary destinations'
Remote names are not magical. They are just labels stored in the local repository config.
Show More Detail About One Remote
If you want more than the URL, inspect one remote directly:
This can display:
- fetch URL
- push URL
- tracked branches
- which remote branch your local branches track
- whether stale references exist
This is useful when the question is not just "what remotes exist" but "how is this remote wired into my branch workflow."
Read the URLs Explicitly
If you only want a single remote's URL without the extra formatting:
And if you need the push URL specifically:
This is handy in scripts, CI, or when checking whether fetch and push URLs differ.
Remotes Live in Git Config
Under the hood, remotes are stored in Git configuration.
You can inspect them directly:
That may produce output like:
This is useful when you need to understand the actual config rather than the friendly command output.
Add, Rename, and Remove Remotes
Listing remotes is often the first step before changing them.
Add a new one:
Rename one:
Remove one:
These commands operate on the local repository only. They do not delete the remote server itself.
When git remote Shows Nothing
If git remote returns no output, that usually means:
- the repository has no remotes configured
- it was initialized with
git initand no remote was added - a remote was removed earlier
That is not an error by itself. Git works fine without remotes; it just means the repository is not currently linked to any external repository locations.
Common Pitfalls
- Using
git remoteand expecting URLs when it only shows names. - Assuming
originis special beyond being a common default name. - Forgetting that fetch and push URLs can differ.
- Looking only at branch tracking and not verifying the actual remote URL.
- Thinking remote removal deletes the hosted repository rather than only the local reference.
Summary
- Use
git remoteto list remote names. - Use
git remote -vto list names plus fetch and push URLs. - Use
git remote show <name>for more detailed remote information. - Use
git remote get-url <name>when you need one exact URL. - Remotes are local configuration entries, not special built-in server objects.

