LoginSignup
8

More than 5 years have passed since last update.

brew updateでGitのエラーが出た場合

Posted at

Mac OSX 10.9.5の場合の話です。
久しぶりにHomebrewのupdateをしようとしたらこんなエラーが出ました。

$sudo brew update
Password:
error: Your local changes to the following files would be overwritten by merge:
    .gitignore
    .yardopts
    CODEOFCONDUCT.md
    CONTRIBUTING.md
    LICENSE.txt
--省略--
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

見たところgitのエラーっぽいので手動で以下を実行

$ cd $(brew --prefix)
$ git fetch origin
$ sudo git reset --hard origin/master

再度brew updateを実行すると

$ sudo brew update
Updated Homebrew from b11f75bf to b11f75bf.
==> Updated Formulae

ということで無事に完了しました。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8