Live streamJoin us for "State of code review 2024" on July 18thRegister today

How to retrieve the remote URL in Git

Kenny DuMez
Kenny DuMez
Graphite software engineer


This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.

A remote URL in Git refers to the network path of your Git repository that is stored on a remote server, which can be accessed over the internet or a local network. This guide will walk you through the steps to find the remote URL of your Git repo, explaining the commands and providing tips to effectively manage your remotes.

A remote in Git is a common repository that all team members use to exchange their changes. In most cases, the remote repository is on a server on the internet or on your local network. The default remote is usually named origin, but Git supports having multiple remotes for a single local repository.

Start by opening your terminal (Linux or macOS) or command prompt/Git Bash (Windows) and navigate to your local Git repository using the cd command.

To see a list of all remotes and their associated URLs, use the following command:

git remote -v

This command displays all the remotes linked to your repository. The -v flag stands for "verbose", which tells Git to also show the URLs associated with the remote names. Typically, this will list both fetch and push URLs for each remote. The fetch URL is used by Git to download content from the remote repository, whereas the push URL is used to upload content to it. This dual listing helps you understand where your changes are being fetched from and where they are being pushed to.

The output from git remote -v might look something like this:

origin (fetch)
origin (push)
upstream (fetch)
upstream (push)
  • origin/upstream: These are the names of the remotes. origin is usually the default remote given to the server from which the repository was first cloned. upstream is often used to refer to the original repository when your repository is a fork of another.
  • URLs: These are the paths that Git uses to fetch from and push to the remote. They can be HTTPS URLs or SSH addresses.
  • (fetch)/(push): Indicates whether the URL is used for fetching or pushing.

If you need more information about a specific remote, use the git remote show command followed by the name of the remote:

git remote show origin

This command will provide detailed information about the origin remote, including its fetch and push URLs, the tracking branches, and more.

If you find that the remote URL needs to be updated (for instance, if the repository has moved), you can change it using the git remote set-url command:

git remote set-url origin new-url

Replace new-url with the actual URL you want to set.

For further reading on Git remotes, see the official Git documentation.

Stay unblocked. Ship faster.
Experience the new developer workflow - create, review, and merge code continuously. Get started with one command.
Get started

Give your PR workflow
an upgrade today

Stack easier | Ship smaller | Review quicker

Or install our CLI.
Product Screenshot 1
Product Screenshot 2