GIT: Find remote URL

GIT: Find remote URL

A short article to find remote URL where the GIT repository is cloned from.

There are several methods with which we can find remote URL for the existing GIT repository.

Let’s check them all out.

GIT: Find remote URL

We can use the git-remote command for GIT which can provide a whole bunch of information. Working with git-remote can be a whole different topic, which I would like to discuss in a seperate article. We will limit ourself to find the details of the remote repository.

We can use the following command to get this information.

git remote show origin

The output should be something like below:

 
* remote origin
  Fetch URL: [email protected]:my_project-repo.git
  Push  URL: [email protected]:my_project-repo.git
  HEAD branch: master
  Remote branches:
    v_1.0     tracked
    v_1.2     tracked
    master    tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local refs configured for 'git push':
    v_1.2     pushes to v_1.2     (up to date)
    master    pushes to master    (local out of date)
The Fetch URL should be the remote URL you are looking for.

You can find more information about git-remote at the following documentation.

git-remote

GIT: Find remote URL

You can also use the git-config command for GIT.

The following is the syntax to use this command.

git config –get remote.origin.url

The output should provide you with just the remote URL:

[email protected]:my_project-repo.git


You can find more information about git-config at the following documentation.

git-config

GIT: Find remote URL

And lastly, you can read the file .git/config under the repository root.

GIT: Find remote URL

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.