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


当前回答

我基本上使用:

git remote get-url origin

在 Windows 中,它适用于 Git Bash 命令控制台或 CMD 命令控制台。

其他回答

我基本上使用:

git remote get-url origin

在 Windows 中,它适用于 Git Bash 命令控制台或 CMD 命令控制台。

要得到答案:

git ls-remote --get-url [REMOTE]

這比閱讀配置更好;引用 git-ls-remote 的男性頁面:

--get-url 将该远程存储库的 URL 扩展,考虑到任何“url.<base>.insteadOf”配置设置(见 git-config(1)),并将其输出而不与远程存储库进行谈话。

正如 @Jefromi 指出的那样,此选项在 v1.7.5 中添加,并且直到 v1.7.12.2 (2012-09 ) 之前没有文档。

你用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 不重要。

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

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

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