我在GitHub上拖了一個有幾個福克的項目,但忘記了它是哪個福克。
当前回答
对于我来说,这就是最简单的方式(少打字):
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 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'
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 URL 将位于 Git 配置文件中,值相当于关键 URL。
对于 Mac 和 Linux,请使用下面的命令:
cd project_dir
cat .git/config | grep url | awk '{print $3}'
在 Windows 中,在任何文本编辑器中打开下面的文件,并找到关键URL的值。
project_dir/.git/config
注意: 即使您离线或远程 Git 服务器已被删除,这也将工作。
你用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 不重要。
获取原产地的 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 ":"
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- 在GitHub上有一个公共回购的私人分支?
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- 只用GitHub动作在特定分支上运行作业
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 是否有一个链接到GitHub下载文件的最新版本的存储库?