尝试更新brew包管理器时出错

发布于 2024-11-27 22:30:58 字数 369 浏览 1 评论 0原文

我尝试更新brew:

sudo brew update

但出现此错误:

错误:您对以下文件的本地更改将被合并覆盖:

列出很多文件

错误:执行 git pull 时失败 http://github.com/mxcl/homebrew.git大师

知道出了什么问题吗?

I tried to update brew:

sudo brew update

But I got this error:

error: Your local changes to the following files would be overwritten by merge:

Listing a lot of files

Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master

Any idea what is going wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

琉璃梦幻 2024-12-04 22:30:58

Homebrew 中有一个错误,几天前已修复。要修复该错误,您可以在 Homebrew 安装中运行 git reset --hard FETCH_HEAD 。由于这不会修复已被视为已修改的文件,您还可以运行 git checkout Library 来用最新文件替换您的结账。 (这会擦除所有编辑内容,因此请对您所做的任何内容采取适当的措施。)

There was a bug in Homebrew that was fixed just a few days ago. To fix the bug you can run git reset --hard FETCH_HEAD inside your Homebrew installation. Since that won't fix files that are already seen as modified you can also run git checkout Library to replace your checkout with the latest files. (That wipes all edits so take appropriate measures with any you made.)

鼻尖触碰 2024-12-04 22:30:58

接受的答案是正确的但不完整。如果您收到错误

错误:以下未跟踪的工作树文件将被合并覆盖:

然后转到您的终端并运行这些命令

cd /usr/local

然后

git reset --hard FETCH_HEAD

然后

git checkout Library

这应该让一切按顺序进行。然后运行

brew update

The accepted answer is correct but incomplete. If you are getting the error of

error: The following untracked working tree files would be overwritten by merge:

Then go to your terminal and run these commands

cd /usr/local

Then

git reset --hard FETCH_HEAD

Then

git checkout Library

That should get everything in order. Then run

brew update
悲念泪 2024-12-04 22:30:58

让我添加:cd /usr/local/git
然后运行 ​​git reset --hard FETCH_HEAD

Let me add: cd /usr/local/git
and then run git reset --hard FETCH_HEAD

冬天旳寂寞 2024-12-04 22:30:58

转到您的终端并运行这些命令

cd /usr/local

sudo git reset --hard FETCH_HEAD

sudo git checkout Library

go to your terminal and run these commands

cd /usr/local

sudo git reset --hard FETCH_HEAD

sudo git checkout Library
脱离于你 2024-12-04 22:30:58

对于使用 OS X El Capitan 的用户来说,您的问题可能是系统完整性保护。

如果 /usr/local 已存在,请在终端中运行以下命令:

sudo chown -R $(whoami):admin /usr/local

如果 /usr/local 不存在:

首先,尝试创建 /usr/local< /code> 正常方式:

sudo mkdir /usr/local && sudo chflags norestricted /usr/local && sudo chown -R $(whoami):admin /usr/local

如果您看到权限问题,请尝试:

  1. 重新启动到恢复模式(启动时按住 Cmd+R)&访问终端。
  2. 在该终端中运行: csrutil disable
  3. 重新启动回到 OS X
  4. 打开终端应用程序并执行上面的行
  5. 重新启动回到恢复模式并执行以下命令:再次访问终端。
  6. 在该终端中执行:csrutil enable
  7. 重新启动至 OS X 和 OS X。您将能够写入 /usr/local &安装自制程序。

For those of you using OS X El Capitan, your problem may be System Integrity Protection.

If /usr/local exists already, run the following in Terminal:

sudo chown -R $(whoami):admin /usr/local

If /usr/local does not exist:

First, try to create /usr/local the normal way:

sudo mkdir /usr/local && sudo chflags norestricted /usr/local && sudo chown -R $(whoami):admin /usr/local

If you see permission issues instead try:

  1. Reboot into Recovery mode (Hold Cmd+R on boot) & access the Terminal.
  2. In that terminal run: csrutil disable
  3. Reboot back into OS X
  4. Open your Terminal application and execute the line from just above
  5. Reboot back into Recovery Mode & access the Terminal again.
  6. In that terminal execute: csrutil enable
  7. Reboot back into OS X & you'll be able to write to /usr/local & install Homebrew.
时光暖心i 2024-12-04 22:30:58

出于某种原因(或者至少我不明白),/usr/local 中的存储库(即brew 安装!)丢失了其远程存储库。因此,git resetgit pull 都不起作用,并且肯定没有 brew update 起作用。

你怎么知道这件事发生了?检查/usr/local/.git/config是否有类似下面的行:

[remote "origin"]
url = http://github.com/mxcl/homebrew.git
fetch = +refs/heads/*:refs/remotes/origin/*

如果没有则执行如下操作:

cd /usr/local
git remote add origin http://github.com/mxcl/homebrew.git
git pull origin master

Out of no reason (or at least no one I'd understand) the repository in /usr/local (which is the brew install!) lost its remote repository. So, neither a git reset nor a git pull and for sure no brew update would work.

How do you know that happened? Check /usr/local/.git/config whether there are some lines like the following:

[remote "origin"]
url = http://github.com/mxcl/homebrew.git
fetch = +refs/heads/*:refs/remotes/origin/*

If not do as follows:

cd /usr/local
git remote add origin http://github.com/mxcl/homebrew.git
git pull origin master
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文