我在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}'
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- 在GitHub上有一个公共回购的私人分支?
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- 只用GitHub动作在特定分支上运行作业
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 是否有一个链接到GitHub下载文件的最新版本的存储库?