How to Check Remote Origin URL of a Local Git Repository?

In Git, remote repositories serve as centralized resources where code is stored and shared among team members. When working with a local Git repository, it’s important to know the URL of its remote origin, as it determines where changes are pushed and pulled from. In this article, we’ll learn how to check the remote origin URL of a local Git repository.

What is a Remote Origin URL?

The Remote Origin URL in Git refers to the web address of the remote repository from which a local repository was cloned or to which it is connected for pushing and pulling changes. It serves as the primary connection point between the local repository and its corresponding remote repository, enabling you to collaborate, synchronize, and share code across distributed environments seamlessly.

Steps To Check The Remote Origin URL Of A Local Git Repository

Step 1: Check the list of branches.

Open up the git bash terminal and navigate to the directory of the repository on your local machine.

Step 2: Check the remote origin URL.

Now Type and run the following command in the git bash terminal. This command will list all remote repositories that are the part of your local repository along with their URLs. We have created a remote test repository “testRepo” and we can find the origin URL by running the following command.

git remote -v

git remote repositories and their URLs.

Here:

  • git: This is the command-line interface for using Git.
  • remote: It denotes the remote repositories hosted on github or other platforms.
  • -v: It denotes the verbose mode. When using -v with git remote, it basically list out the additional information of remote repositories like origin URLs etc.

Additionally You can also use the following command to check the remote origin URL of local git repository.

git config --get remote.origin.url

git remote origin URL.