Git: Show Remote URL & Check Origin

Remotes in Git are simply aliases that store the URLs of repositories.

By convention, an origin is the alias of the default remote repository where you publish your commits.

In Git you can work with several remotes with different aliases.

From this note you will find out how to show the configured remote URLs of a local Git repository, including the origin URL.

Cool Tip: How to list all the remote and local branches in Git! Read more →

Show Remote URL in Git

If you wonder what are the remote URLs of a local Git repository, simply execute the git remote -v command:

$ git remote -v
- sample output -
origin<username>/<repo>.git (fetch)
origin<username>/<repo>.git (push)

An empty output means, there are no remote URLs configured.

To show details about the particular remote:

$ git remote show <alias>

For example, to show the remote origin URLs, execute:

$ git remote show origin
- sample output -
* remote origin
  Fetch URL:<username>/<repo>.git
  Push  URL:<username>/<repo>.git
  HEAD branch: master
  Remote branch:
    master new (next fetch will store in remotes/origin)
  Local ref configured for 'git push':
    master pushes to master (up to date)

Cool Tip: Show Git config settings! Read more →

Was it useful? Share this post with the world!

Leave a Reply