How to Determine the URL That a Local Git Repository Was Originally Cloned From

Better Stack Team
Updated on June 24, 2024

To determine the URL that a local Git repository was originally cloned from, you can use the git remote command with the -v option. Here's how:

 
git remote -v

This command will display the URLs associated with your local repository's remote repositories. It will show both the fetch and push URLs for each remote repository.

Example output:

 
origin  <https://github.com/username/repository.git> (fetch)
origin  <https://github.com/username/repository.git> (push)

In this example, origin is the name of the remote repository, and https://github.com/username/repository.git is the URL that the local repository was originally cloned from.

If you have multiple remotes, each remote's URL will be listed along with its associated fetch and push URLs.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github