我在GitHub上拖了一個有幾個福克的項目,但忘記了它是哪個福克。
当前回答
我更喜欢这个,因为更容易记住:
git config -l
它将列出所有有用的信息,如:
user.name=Your Name
user.email=your.name@notexisting.com
core.autocrlf=input
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/mapstruct/mapstruct-examples
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
其他回答
此将打印您的所有远程的Fetch/Push URL:
git remote -v
git config --list
此命令将提供与您的存储库相关的所有信息。
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
你用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 不重要。
要总结一下,至少有四种方式:
使用官方 Linux 存储库:
最小信息:
$ git config --get remote.origin.url
https://github.com/torvalds/linux.git
和
$ git ls-remote --get-url
https://github.com/torvalds/linux.git
更多信息:
$ git remote -v
origin https://github.com/torvalds/linux.git (fetch)
origin https://github.com/torvalds/linux.git (push)
更多信息:
$ git remote show origin
* remote origin
Fetch URL: https://github.com/torvalds/linux.git
Push URL: https://github.com/torvalds/linux.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
推荐文章
- 在Markdown Jekyll中使用图像说明
- 如何将git配置存储为存储库的一部分?
- 如何修改GitHub拉请求?
- 如何在Github和本地删除最后n次提交?
- 我如何调试git/git-shell相关的问题?
- 错误:无法使用rebase进行拉取:您有未分阶段的更改
- Git隐藏未缓存:如何把所有未分期的变化?
- 如何将文件附加到GitHub问题?
- 真实的恶魔
- 如何从另一个分支获得更改
- Git:权限被拒绝(publickey)致命-无法从远程存储库读取。克隆Git存储库时
- git reflog和log有什么区别?
- git推挂在Total line之后
- 重命名git子模块
- 如何添加谷歌分析跟踪ID到GitHub页面