如何获取仓库的远程git地址?


Answers:


270

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

git remote -v

但是,这显示了所有远程控制,源和其他,我如何仅检索分支机构中的那个?
rubo77 '16

1
也许您需要的是git remote get-url remote-name
Cipto HD

61

如果您拥有遥控器的名称,则可以使用git 2.7(Q4 2015)使用新git remote get-url命令:

git remote get-url origin

(的漂亮的吊坠git remote set-url origin <newurl>

参见Ben Boeckel()提交的96f78d3(2015年9月16日(通过合并JUNIOÇ滨野- -提交e437cbd,2015年10月5日)mathstuf
gitster

远程:添加get-url子命令

扩展insteadOf是扩展的一部分,ls-remote --url也没有扩展的pushInsteadOf方法。
添加一个get-url子命令,以便能够同时查询和获取所有已配置网址的方法。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.