我在GitHub上拖了一個有幾個福克的項目,但忘記了它是哪個福克。
当前回答
git config --list
此命令将提供与您的存储库相关的所有信息。
其他回答
要补充其他答案:如果远程因某种原因已被更改,因此不反映原来的起源,则重组中的第一个输入(即由命令 git reflog 显示的最后一个输入)应指明重组原来的位置。
吉。
$ git reflog | tail -n 1
f34be46 HEAD@{0}: clone: from https://github.com/git/git
$
(请记住,返回可以被清理,所以这不保证工作。
Git URL 将位于 Git 配置文件中,值相当于关键 URL。
对于 Mac 和 Linux,请使用下面的命令:
cd project_dir
cat .git/config | grep url | awk '{print $3}'
在 Windows 中,在任何文本编辑器中打开下面的文件,并找到关键URL的值。
project_dir/.git/config
注意: 即使您离线或远程 Git 服务器已被删除,这也将工作。
#!/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
我基本上使用:
git remote get-url origin
在 Windows 中,它适用于 Git Bash 命令控制台或 CMD 命令控制台。
git config --list
此命令将提供与您的存储库相关的所有信息。
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的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下载文件的最新版本的存储库?