首页 > 解决方案 > 卸载和安装 Homebrew 时出现 Git 错误

问题描述

因此,出于某种原因,我使用 Ruby 命令从计算机上卸载了 Homebrew,该命令显示“这将卸载所有使用 Brew 安装的软件包”。我这样做了,现在当我再次尝试安装 Homebrew 时,我收到一个 Git 错误,提示“请确保您具有正确的访问权限”。

我认为这个错误是因为卸载 Brew 卸载了 Git,但是当我输入“git --version”时,我得到“git version 2.15.0”,所以这不是问题。

然后我生成了一个新的 SSH 密钥,并将公钥添加到我的 git 帐户中。正在做

ssh -T git@github.com

给我

Hi {{username}}! You've successfully authenticated, but GitHub does not provide shell access

即使我尝试 git clone 我自己的 repo,我也会得到同样的错误:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这是 Brew 安装的日志

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Homebrew
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown rafaykalim /usr/local/Homebrew
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

我还手动删除了 /usr/local/Homebrew。这是卸载 Brew 的命令:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

编辑:我刚从我的电脑上卸载了 git,我仍然遇到同样的错误。不知道发生了什么!

我使用此脚本卸载 Git: https ://gist.github.com/naomik/11245234

标签: githomebrew

解决方案


推荐阅读