如何获取之前克隆的Git代码库?

5

克隆 git 存储库后,如何获取存储库文件?

例如:

在执行 "git clone http://sunglim@github.com/asdf/asdf.git" 后,

我想知道 URL(http://sunglim@github.com/asdf/asdf.git)。

我该怎么做?

2个回答

12

你可以使用remote show,尽管它会要求你的密钥:

git remote show origin | grep 'Fetch URL'

2
为避免被要求输入密钥,请使用“-n”选项。 - Alexander Gladysh

6

如果您查看.git/config文件,应该会有一个类似以下的块:

[remote "origin"]
    fetch = ...
    url = <this is the url you want>

您可以通过命令行获取此内容,使用以下命令:

git config --get remote.origin.url

希望这能满足您的需求。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接