我在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 show -n origin
或者,一个纯粹的快速脚本的替代品:
$ git config --get remote.origin.url
一些信息:
你想要起源正确吗? $ git 远程显示起源更好,只显示起源,但需要太长时间(测试在 git 版本 1.8.1.msysgit.1)。
我结束了: $ git 远程显示 -n 起源,似乎是最快的. 与 -n 它不会捕捉远程头(AKA 分支)。 你不需要这种类型的信息,对吗?
http://www.kernel.org/pub//software/scm/git/docs/git-remote.html
您可以在所有 3 个版本中使用 <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk> <unk>
如果你需要纯粹的速度,那么使用:
$ git config --get remote.origin.url
谢谢 @Jefromi 提到这一点。
alias git-repo="git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g'"
alias git-pr="git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g' | sed 's/....$//' | sed -ne 's/$/\/pulls &/p'"
在主目录中将此表达式添加到.zshrc 或.bashrc 文件中。
在此之后,您可以使用如
git-repo
git-pr
一个简单的方式是打开.git/config 文件:
cat .git/config
编辑:
vim.git/config 或
纳米.git/config
这只提供URL,这对脚本目的有用:
git config --get remote.origin.url
获取原产地的 IP 地址/主机名称
对于 ssh:// 存储库:
git ls-remote --get-url origin | cut -f 2 -d @ | cut -f 1 -d "/"
關於 git:// repositories:
git ls-remote --get-url origin | cut -f 2 -d @ | cut -f 1 -d ":"
推荐文章
- “node_modules”文件夹应该包含在git存储库中吗
- 为什么git-rebase给了我合并冲突,而我所做的只是压缩提交?
- 如何运行一个github-actions步骤,即使前一步失败,同时仍然失败的工作
- 当我试图推到原点时,为什么Git告诉我“没有这样的远程‘原点’”?
- 在GitHub repo上显示Jenkins构建的当前状态
- 如何从远程分支中挑选?
- 如何查看一个分支中的哪些提交不在另一个分支中?
- 如何取消在github上的拉请求?
- HEAD和master的区别
- GIT克隆在windows中跨本地文件系统回购
- RPC失败;卷度传输已关闭,剩余未完成的读取数据
- 我应该在.gitignore文件中添加Django迁移文件吗?
- 错误:您对以下文件的本地更改将被签出覆盖
- Git rebase—即使所有合并冲突都已解决,仍然会继续报错
- 在Git中,我如何知道我的当前版本是什么?