我在GitHub上拖了一個有幾個福克的項目,但忘記了它是哪個福克。


当前回答

此将打印您的所有远程的Fetch/Push URL:

git remote -v

其他回答

要总结一下,至少有四种方式:

使用官方 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)

Git URL 将位于 Git 配置文件中,值相当于关键 URL。

对于 Mac 和 Linux,请使用下面的命令:

cd project_dir
cat .git/config | grep url | awk '{print $3}'

在 Windows 中,在任何文本编辑器中打开下面的文件,并找到关键URL的值。

project_dir/.git/config

注意: 即使您离线或远程 Git 服务器已被删除,这也将工作。

要补充其他答案:如果远程因某种原因已被更改,因此不反映原来的起源,则重组中的第一个输入(即由命令 git reflog 显示的最后一个输入)应指明重组原来的位置。

吉。

$ git reflog | tail -n 1
f34be46 HEAD@{0}: clone: from https://github.com/git/git
$

(请记住,返回可以被清理,所以这不保证工作。

git config --list

此命令将提供与您的存储库相关的所有信息。

打印自愿命名的远程 fetch URL:

git remote -v | grep fetch | awk '{print $2}'