git 如何更新 Homebrew?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6024671/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:56:57  来源:igfitidea点击:

How do I update Homebrew?

githomebrew

提问by andrewpthorp

When I ran:

当我跑:

brew update

I got a message saying it initialized an empty repository in /usr/local/.git/, then I got this error:

我收到一条消息,说它在 中初始化了一个空的存储库/usr/local/.git/,然后我收到了这个错误:

Screenshot

截屏

回答by corysimmons

  • cd /usr/local
  • git status
  • Discard all the changes (unless you actually want to try to commit to Homebrew - you probably don't)
  • git statustil it's clean
  • brew update
  • cd /usr/local
  • git status
  • 放弃所有更改(除非您确实想尝试使用 Homebrew - 您可能不想)
  • git status直到它干净
  • brew update

回答by Peter O'Brien

Alternatively you could update brewby installing it again. (Think I did this as El Capitan changed something)

或者,您可以brew通过再次安装来更新。(认为​​我这样做是因为 El Capitan 改变了一些东西)

Note: this is a heavy handed approach that will remove all applications installed via brew!

注意:这是一种笨手笨脚的方法,它将删除所有通过 brew 安装的应用程序!

Try to install brew a fresh and it will tell how to uninstall.

尝试重新安装 brew,它会告诉如何卸载。

At original time of writing to uninstall:

在撰写卸载的原始时间:

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