如何确定最初克隆本地 Git 存储库的 URL? [英] How can I determine the URL that a local Git repository was originally cloned from?

查看:35
本文介绍了如何确定最初克隆本地 Git 存储库的 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几天前从 GitHub 拉取了一个项目.后来我发现 GitHub 上有好几个分叉,我忽略了我最初拿的是哪一个.我如何确定我拉的是哪个分叉?

I pulled a project from GitHub a few days ago. I've since discovered that there are several forks on GitHub, and I neglected to note which one I took originally. How can I determine which of those forks I pulled?

推荐答案

如果您只想要远程 URL,或者您没有连接到可以访问远程仓库的网络:

If you want only the remote URL, or if your are not connected to a network that can reach the remote repo:

git config --get remote.origin.url

如果您需要完整的输出并且位于可以访问源所在的远程存储库的网络上:

If you require full output and you are on a network that can reach the remote repo where the origin resides :

git remote show origin

当使用 git clone(来自 GitHub 或任何与此相关的源存储库)时,克隆源的默认名称是origin".使用 git remote show 将显示有关此远程名称的信息.前几行应显示:

When using git clone (from GitHub, or any source repository for that matter) the default name for the source of the clone is "origin". Using git remote show will display the information about this remote name. The first few lines should show:

C:UsersjaredparVsVim> 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:

如果您想在脚本中使用该值,您可以使用本答案中列出的第一个命令.

If you want to use the value in the script, you would use the first command listed in this answer.

这篇关于如何确定最初克隆本地 Git 存储库的 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆