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


当前回答

只需使用此命令在您的.git 文件夹的位置:

git config --get remote.origin.url

如果你连接到一个网络,

git remote show origin

它将向您显示一个本地Git存储库原来被克隆的URL。

其他回答

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

git remote -v

一个简单的方式是打开.git/config 文件:

cat .git/config

编辑:

vim.git/config 或

纳米.git/config

#!/bin/bash

git-remote-url() {
 local rmt=$1; shift || { printf "Usage: git-remote-url [REMOTE]\n" >&2; return 1; }
 local url

 if ! git config --get remote.${rmt}.url &>/dev/null; then
  printf "%s\n" "Error: not a valid remote name" && return 1
  # Verify remote using 'git remote -v' command
 fi

 url=`git config --get remote.${rmt}.url`

 # Parse remote if local clone used SSH checkout
 [[ "$url" == git@* ]] \
 && { url="https://github.com/${url##*:}" >&2; }; \
 { url="${url%%.git}" >&2; };

 printf "%s\n" "$url"
}

使用:

# Either launch a new terminal and copy `git-remote-url` into the current shell process, 
# or create a shell script and add it to the PATH to enable command invocation with bash.

# Create a local clone of your repo with SSH, or HTTPS
git clone git@github.com:your-username/your-repository.git
cd your-repository

git-remote-url origin

出口:

https://github.com/your-username/your-repository

只需远程 URL:

git config --get remote.origin.url

要了解有关特定远程的详细信息,请使用

git remote show [remote-name] command

查看远程URL:

git remote show origin

要查看您在哪里放置.git 文件夹:

git config --get remote.origin.url

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

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