如何检索 repo 的远程 git 地址?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8816107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:42:40  来源:igfitidea点击:

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

git

提问by fancy

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

如何检索 repo 的远程 git 地址?

I tried git remote but that just lists the branches.

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

回答by Jan Marek

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

当您想显示远程分支的 URL 时,请尝试:

git remote -v

回答by VonC

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-urlcommand:

如果您有遥控器的名称,您将能够在 git 2.7(2015 年第 4 季度)中使用新git remote get-url命令:

git remote get-url origin

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

(漂亮的吊坠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)

请参阅Ben Boeckel( )提交的 96f78d3(2015 年 9 月 16 日(由Junio C Hamano合并-- --提交 e437cbd,2015 年 10 月 5 日)mathstuf
gitster

remote: add get-url subcommand

Expanding insteadOfis a part of ls-remote --urland there is no way to expand pushInsteadOfas well.
Add a get-urlsubcommand to be able to query both as well as a way to get all configured urls.

远程:添加 get-url 子命令

扩展insteadOf是其中的一部分,ls-remote --url也无法扩展pushInsteadOf
添加一个get-url子命令以能够查询两者以及获取所有配置的 url 的方法。