2012-01-11 44 views
131

如何检索回购的远程git地址?如何检索回购的远程git地址?

我试过git remote但只是列出了分支。

+35

这是'git remote -v' – CharlesB 2012-01-11 08:17:37

+1

woooooo!谢谢 – fancy 2012-01-11 08:18:08

+0

可能的重复[如何确定本地git回购最初克隆的url?](http://stackoverflow.com/questions/4089430/how-can-i-determine-the-url-that- a-local-git-repo-was-original-cloned-from) – mvw 2014-04-11 10:53:37

回答

191

当你想显示远程分支机构的URL,请尝试:

git remote -v 
+0

谢谢。这也适用于Git旧版本。 – Davide 2016-10-12 14:00:26

+0

但是,这显示所有的遥控器,起源和其他人,我如何检索只有一个,我在一个分支上? – rubo77 2016-11-16 11:02:35

+0

也许你需要的是'git remote get-url remote-name' – 2017-10-31 17:08:47

36

如果有遥控器的名字,你就可以使用Git 2.7(Q4 2015年),以使用新的git remote get-url命令:

git remote get-url origin 

(的git remote set-url origin <newurl>好的挂件)

通过Ben Boeckel (mathstuf)参见commit 96f78d3(2015年9月16日)。
(在commit e437cbdJunio C Hamano -- gitster --合并,2015年10月5日)

远程:添加得到-URL子

扩大insteadOfls-remote --url的一部分,没有办法 扩大pushInsteadOf以及。
添加get-url子命令以便能够查询以及获取所有配置的URL的方法。