我在GitHub上拖了一個有幾個福克的項目,但忘記了它是哪個福克。


当前回答

你用SSH克隆来克隆你的存储库。

git config --get remote.origin.url
git@gitlab.com:company/product/production.git

但是,您想要在浏览器中打开或分享一个 HTTP URL:

git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g'

https://gitlab.com/company/product/production.git

GitHub 或 GitLab 不重要。

其他回答

对于我来说,这就是最简单的方式(少打字):

git remote -v

出口:

origin    https://github.com/torvalds/linux.git (fetch)
origin    https://github.com/torvalds/linux.git (push)

事实上,我把它放在一个名为 s 的 alias 中,它:

git remote -v
git status

您可以添加到您的个人资料:

alias s='git remote -v && git status'

我永远不会记住所有参数到 Git 命令,所以我只是在 ~/.gitconfig 文件中插入一个标志,这对我来说更有意义,所以我可以记住它,结果写得更少:

[alias]
url = ls-remote --get-url

重新加载终端后,您只能输入:

> git url

以下是我经常使用的一些:

[alias]
cd = checkout
ls = branch
lsr = branch --remote
lst = describe --tags

我也强烈推荐 git-extra 具有 git info 命令,提供远程和本地分支的更多详细信息。

只需使用此命令在您的.git 文件夹的位置:

git config --get remote.origin.url

如果你连接到一个网络,

git remote show origin

它将向您显示一个本地Git存储库原来被克隆的URL。

git config --list

此命令将提供与您的存储库相关的所有信息。

打印自愿命名的远程 fetch URL:

git remote -v | grep fetch | awk '{print $2}'