Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
459 views
in Technique[技术] by (71.8m points)

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

I pulled a project from GitHub a few days ago.

(几天前我从GitHub上撤了一个项目。)

I've since discovered that there are several forks on GitHub, and I neglected to note which one I took originally.

(我已经发现GitHub上有几个叉子,我忽略了我最初采用的那个。)

How can I determine which of those forks I pulled?

(如何确定我拉出的哪个叉子?)

  ask by Tim translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

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

When using git clone (from GitHub, or any source repository for that matter) the default name for the source of the clone is "origin".

(当使用git clone (来自GitHub或任何源存储库)时,克隆源的默认名称是“origin”。)

Using git remote show will display the information about this remote name.

(使用git remote show将显示有关此远程名称的信息。)

The first few lines should show:

(前几行应显示:)

C:UsersjaredparVsVim> git remote show origin
* remote origin
  Fetch URL: [email protected]:jaredpar/VsVim.git
  Push  URL: [email protected]: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.

(如果要使用脚本中的值,可以使用此答案中列出的第一个命令。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...