225

How can I retrieve the remote git address of a repo?

I tried git remote but that just lists the branches.

fancy
  • 48,619
  • 62
  • 153
  • 231
  • 59
    This is `git remote -v` – CharlesB Jan 11 '12 at 08:17
  • possible duplicate of [How can I determine the url that a local git repo was originally cloned from?](http://stackoverflow.com/questions/4089430/how-can-i-determine-the-url-that-a-local-git-repo-was-originally-cloned-from) – mvw Apr 11 '14 at 10:53

4 Answers4

318

When you want to show an URL of remote branches, try:

git remote -v
Jan Marek
  • 10,390
  • 3
  • 21
  • 19
82

If you have the name of the remote, you will be able with git 2.7 (Q4 2015), to use the new git remote get-url command:

git remote get-url origin

(nice pendant of git remote set-url origin <newurl>)

See commit 96f78d3 (16 Sep 2015) by Ben Boeckel (mathstuf).
(Merged by Junio C Hamano -- gitster -- in commit e437cbd, 05 Oct 2015)

remote: add get-url subcommand

Expanding insteadOf is a part of ls-remote --url and there is no way to expand pushInsteadOf as well.
Add a get-url subcommand to be able to query both as well as a way to get all configured urls.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

-v. Shows URLs of remote repositories when listing your current remote connections. By default, listing remote repositories only shows you their shortnames (e.g. "origin"). Using the "-v" option, you will also see the remote's URLs in listings.

git remote -v
sathish
  • 59
  • 9
0

The long boring solution, which is not involved with CLI, you can manually navigate to:

your local repo folder ➡ .git folder (hidden) ➡ config file

then choose your text editor to open it and look for url located under the [remote "origin"] section.

A.I.
  • 37
  • 7