我在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
其他回答
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
这只提供URL,这对脚本目的有用:
git config --get remote.origin.url
git remote get-url origin
(Git 远程设置 URL 起源 <newurl>)
See commit 96f78d3 (2015 年 9 月 16 日) by Ben Boeckel (mathstuf). (Merged by Junio C Hamano -- gitster -- in commit e437cbd, 2015 年 10 月 5 日):
远程: 添加 Get-url 子命令 扩展代替Of 是 ls-remote --url 的部分,并且没有办法扩展 pushInsteadOf 也。
get-url:
将 URL 转移到远程. 设置为替代Of 和 pushInsteadOf 在这里扩展. 默认情况下,只有第一个 URL 被列入. 通过“--push”,按 URL 被查询而不是接收 URL. 通过“--all”,所有 URL 被列入远程。
在 git 2.7 之前,你有:
git config --get remote.[REMOTE].url
git ls-remote --get-url [REMOTE]
git remote show [REMOTE]
我永远不会记住所有参数到 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 命令,提供远程和本地分支的更多详细信息。
只需获取远程URL:
git config --get remote.origin.url
如果您需要完整的输出,并且您正在网络上,可以到达原产地的远程雷波:
git remote show origin
当使用 git clone (从 GitHub,或任何源存储器为该材料) 的默认名称为 clone 的来源是“起源”。使用 git 远程显示将显示有关这个远程名称的信息。
C:\Users\jaredpar\VsVim> git remote show origin
* remote origin
Fetch URL: git@github.com:jaredpar/VsVim.git
Push URL: git@github.com:jaredpar/VsVim.git
HEAD branch: master
Remote branches:
如果你想在脚本中使用值,你会使用这个答案中列出的第一个命令。
推荐文章
- 如何查看一个分支中的哪些提交不在另一个分支中?
- 如何取消在github上的拉请求?
- HEAD和master的区别
- GIT克隆在windows中跨本地文件系统回购
- RPC失败;卷度传输已关闭,剩余未完成的读取数据
- 我应该在.gitignore文件中添加Django迁移文件吗?
- 错误:您对以下文件的本地更改将被签出覆盖
- Git rebase—即使所有合并冲突都已解决,仍然会继续报错
- 在Git中,我如何知道我的当前版本是什么?
- 跟踪所有远程git分支作为本地分支
- 自定义SSH端口上的Git
- git如何显示不存在于.gitignore中的未跟踪文件
- 在另一个目录中运行操作
- Git错误:遇到7个文件应该是指针,但不是
- GitHub克隆与OAuth访问令牌