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.