如何查找本地 GIT 存储库的 url
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16452415/
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
How to find a url for a local GIT repo
提问by Kye
In our Development environment, I can see that the GIT repository was cloned from TEST,
在我们的开发环境中,我可以看到 GIT 存储库是从 TEST 克隆的,
In the config file,
在配置文件中,
[remote "origin"]
url = //foo/test-foo-project
fetch = +refs/heads/master:refs/remotes/origin/master
I now want to pull the repository in Development, to my local instance. I know //foo/test-foo-project isn't a real path.. But I can determine which URL to use?
我现在想将 Development 中的存储库拉到我的本地实例。我知道 //foo/test-foo-project 不是真正的路径..但我可以确定使用哪个 URL?
采纳答案by jacob aloysious
Git command that could get you the url
from origin
可以让你url
从的Git 命令origin
$git config --get remote.origin.url
$git config --get remote.origin.url
But you would not be able to set a new path
但是您将无法设置新路径
$git config remote.origin.url "newPath"
$git config remote.origin.url "newPath"
This would fail with the message error: could not lock config file ./config: File exists
这将失败并显示消息错误: could not lock config file ./config: File exists
回答by Wojciech Bednarski
In your home directory do less .shh/config
then you can see the URL for foo
.
在您的主目录中 doless .shh/config
然后您可以看到foo
.
If it is not there you can try git remote show
and then probably git remote show origin
.
如果它不存在,您可以尝试git remote show
,然后可能git remote show origin
。
Do you remember how you cloned this repo, can you past the command here?
你还记得你是如何克隆这个 repo 的吗,你能在这里通过命令吗?
回答by Shinya Ohtani
Simply you can find a url for a local GIT repo by giturl
command.
只需通过giturl
命令找到本地 GIT 存储库的 url 。
$ gem install giturl
$ giturl .
https://*****/