Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.97k stars 11.34k forks source link

Error while using brew update #35487

Closed benpptung closed 9 years ago

benpptung commented 9 years ago

I am sorry that I got the following error

error: Your local changes to the following files would be overwritten by merge:
    README.md
Please, commit your changes or stash them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

I am sorry that I don't know ruby, and cannot figure out what happened. Any idea to resolve this problem? Thank you very much :)

fxstein commented 9 years ago

Same here. Can no longer brew update existing machines. Did a fresh install on a new server and all went fine.

fxstein commented 9 years ago

Here is more detail from one of the machines that are now failing to update:

brew doctor
Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks!

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these:

elasticsearch11

Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f

brew update
error: Your local changes to the following files would be overwritten by merge:
.yardopts
LICENSE.txt
Library/Contributions/brew_fish_completion.fish
Library/Contributions/brew_zsh_completion.zsh
Library/Contributions/example-formula.rb
Library/ENV/4.3/bsdmake
Library/ENV/4.3/cc
Library/Formula/a2ps.rb
Library/Formula/abcde.rb
Library/Formula/abcm2ps.rb
Library/Formula/abcmidi.rb
Library/Formula/abnfgen.rb
Library/Formula/ace.rb
Library/Formula/ack.rb
Library/Formula/acme.rb
Library/Formula/acpica.rb
Library/Formula/activemq-cpp.rb
Library/Formula/adns.rb
Library/Formula/adobe-air-sdk.rb
Library/Formula/aescrypt.rb
Library/Formula/afflib.rb
Library/Formula/afsctool.rb
Library/Formula/aget.rb
Library/Formula/aha.rb
Library/Formula/akka.rb
Library/Formula/align.rb
Library/Formula/alpine.rb
Library/Formula/amap.rb
Library/Formula/analog.rb
Library/Formula/android-ndk.rb
Library/Formula/android-platform-tools.rb
Library/Formula/android-sdk.rb
Library/Formula/ansible.rb
Library/Formula/ansifilter.rb
Library/Formula/apache-spark.rb
Library/Formula/ape.rb
Library/Formula/apib.rb
Library/Formula/apngasm.rb
Library/Formula/app-engine-java-sdk.rb
Library/Formula/appscale-tools.rb
Library/Formula/arangodb.rb
Library/Formula/argus-clients.rb
Library/Formula/argus.rb
Library/Formula/aria2.rb
Library/Formula/arp-scan.rb
Library/Formula/artifactory.rb
Library/Formula/asciidoc.rb
Library/Formula/asn1c.rb
Library/Formula/aspell.rb
Library/Formula/assimp.rb
Library/Formula/astyle.rb
Library/Formula/at-spi2-atk.rb
Library/Formula/at-spi2-core.rb
Library/Formula/atomicparsley.rb
Library/Formula/ats2-postiats.rb
Library/Formula/aubio.rb
Library/Formula/auctex.rb
Library/Formula/augeas.rb
Library/Formula/auto-scaling.rb
Library/Formula/autoconf-archive.rb
Library/Formula/autoconf.rb
Library/Formula/autoenv.rb
Library/Formula/autojump.rb
Library/Formula/autossh.rb
Library/Formula/avfs.rb
Library/Formula/avian.rb
Library/Formula/avra.rb
Library/Formula/aws-cfn-tools.rb
Library/Formula/aws-elasticache.rb
Library/Formula/aws-elasticbeanstalk.rb
Library/Formula/aws-sns-cli.rb
Library/Formula/awscli.rb
Library/Formula/bacula-fd.rb
Library/Formula/bash-git-prompt.rb
Library/Formula/bashdb.rb
Library/Formula/bazaar.rb
Library/Formula/bcrypt.rb
Library/Formula/beecrypt.rb
Library/Formula/betty.rb
Library/Formula/bfg.rb
Library/Formula/bibtex2html.rb
Library/Formula/bibutils.rb
Library/Formula/bind.rb
Library/Formula/binutils.rb
Library/Formula/binwalk.rb
Library/Formula/bison.rb
Library/Formula/bitlbee.rb
Library/Formula/blink1.rb
Library/Formula/blitz.rb
Library/Formula/blueutil.rb
Library/Formula/bmon.rb
Library/Formula/boost-bcp.rb
Library/Formula/boost-build.rb
Library/Formula/boost-python.rb
Library/Formula/boost.rb
Library/Formula/boot2docker.rb
Library/Formula/boxes.rb
Library/Formula/bpm-tools.rb
Library/Formula/bsdiff.rb
Library/Formula/buildapp.rb
Library/Formula/bup.rb
Library/Formula/burp.rb
Library/Formula/bvi.rb
Library/Formula/cabextract.rb
Library/Formula/cairo.rb
Library/Formula/cairomm.rb
Library/Formula/capnp.rb
Library/Formula/capstone.rb
Library/Formula/cassandra.rb
Library/Formula/caudec.rb
Library/Formula/cc65.rb
Library/Formula/ccache.rb
Library/Formula/ccextractor.rb
Library/Formula/ccm.rb
Library/Formula/cdparanoia.rb
Library/Formula/cfengine.rb
Library/Formula/cgal.rb
Library/Formula/cgrep.rb
Library/Formula/cheat.rb
Library/Formula/checkbashisms.rb
Library/Formula/cherokee.rb
Library/Formula/chibi-scheme.rb
Library/Formula/chktex.rb
Library/Formula/chromedriver.rb
Library/Formula/chruby.rb
Library/Formula/chuck.rb
Library/Formula/clamav.rb
Library/Formula/clasp.rb
Library/Formula/clhep.rb
Library/Formula/clib.rb
Library/Formula/cliclick.rb
Library/Formula/clojurescript.rb
Library/Formula/closure-compiler.rb
Library/Formula/cloud-watch.rb
Library/Formula/clutter-gtk.rb
Library/Formula/clutter.rb
Library/Formula/cmake.rb
Library/Formula/cocot.rb
Library/Formula/cogl.rb
Library/Formula/colordiff
error: The following untracked working tree files would be overwritten by merge:
Library/.rubocop.yml
Library/Aliases/actor-framework
Library/Aliases/libcaf
Library/Aliases/libgme
Library/Aliases/nim
Library/ENV/pkgconfig/10.6/sqlite3.pc
Library/ENV/pkgconfig/10.6/zlib.pc
Library/ENV/pkgconfig/10.7/sqlite3.pc
Library/ENV/pkgconfig/10.7/zlib.pc
Library/ENV/pkgconfig/10.8/sqlite3.pc
Library/ENV/pkgconfig/10.8/zlib.pc
Library/Formula/abi-compliance-checker.rb
Library/Formula/aescrypt-packetizer.rb
Library/Formula/afl-fuzz.rb
Library/Formula/aptly.rb
Library/Formula/arpon.rb
Library/Formula/asciinema.rb
Library/Formula/baresip.rb
Library/Formula/blucat.rb
Library/Formula/bwctl.rb
Library/Formula/carthage.rb
Library/Formula/cctools.rb
Library/Formula/chinadns-c.rb
Library/Formula/closure-linter.rb
Library/Formula/ctunnel.rb
Library/Formula/davmail.rb
Library/Formula/deis.rb
Library/Formula/distribution.rb
Library/Formula/dsd.rb
Library/Formula/ebook-tools.rb
Library/Formula/epeg.rb
Library/Formula/euler-py.rb
Library/Formula/ffts.rb
Library/Formula/flow.rb
Library/Formula/game-music-emu.rb
Library/Formula/gammaray.rb
Library/Formula/gauge.rb
Library/Formula/gdnsd.rb
Library/Formula/gifify.rb
Library/Formula/git-review.rb
Library/Formula/gitfs.rb
Library/Formula/glbinding.rb
Library/Formula/gnatsd.rb
Library/Formula/hardlink-osx.rb
Library/Formula/hh.rb
Library/Formula/i2util.rb
Library/Formula/icdiff.rb
Library/Formula/id3ed.rb
Library/Formula/idris.rb
Library/Formula/jooby-bootstrap.rb
Library/Formula/kore.rb
Library/Formula/libbpg.rb
Library/Formula/libgit2-glib.rb
Library/Formula/libiomp.rb
Library/Formula/libjson-rpc-cpp.rb
Library/Formula/libpointing.rb
Library/Formula/libsoxr.rb
Library/Formula/lsh.rb
Library/Formula/ltl2ba.rb
Library/Formula/makefile2graph.rb
Library/Formula/megatools.rb
Library/Formula/mitie.rb
Library/Formula/mvnvm.rb
Library/Formula/mysql-sandbox.rb
Library/Formula/nailgun.rb
Library/Formula/nikto.rb
Library/Formula/odo.rb
Library/Formula/odt2txt.rb
Library/Formula/open-zwave.rb
Library/Formula/openh264.rb
Library/Formula/osquery.rb
Library/Formula/pcsc-lite.rb
Library/Formula/pulse.rb
Library/Formula/queequeg.rb
Library/Formula/rbenv-bundle-exec.rb
Library/Formula/rbenv-bundler-ruby-version.rb
Library/Formula/restund.rb
Library/Formula/rocket.rb
Library/Formula/simple-amqp-client.rb
Library/Formula/smali.rb
Library/Formula/snappystream.rb
Library/Formula/snow.rb
Library/Formula/spoof-mac.rb
Library/Formula/src.rb
Library/Formula/stlink.rb
Library/Formula/stoken.rb
Library/Formula/synscan.rb
Library/Formula/tippecanoe.rb
Library/Formula/ucommon.rb
Library/Formula/vavrdiasm.rb
Library/Formula/vnu.rb
Library/Formula/vpcs.rb
Library/Formula/wakatime-cli.rb
Library/Formula/whereami.rb
Library/Formula/with-readline.rb
Library/Homebrew/requirements/tuntap_dependency.rb
Library/Homebrew/test/fixtures/test.mp3
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
MikeMcQuaid commented 9 years ago

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

You modified that file. Use git reset --hard origin/master to restore it to the default (at your own risk).

MikeMcQuaid commented 9 years ago

Here is more detail from one of the machines that are now failing to update:

git fetch; git reset --hard origin/master; brew update (at your own risk)

benpptung commented 9 years ago

Thank you for your reply. :) yes, I think it is git error. Can you advice Where is the local git repository regarding the error? So, I might be able to evaluate why README.md is changed locally. It's so weird because I think I never change any local file.

halhenke commented 9 years ago

Same here - never modified any of these formula:

brew update
error: Your local changes to the following files would be overwritten by merge:
    Library/Formula/bashdb.rb
    Library/Formula/bibutils.rb
    Library/Formula/blueutil.rb
    Library/Formula/bvi.rb
    Library/Formula/carthage.rb
    Library/Formula/ccextractor.rb
    Library/Formula/cheat.rb
    Library/Formula/clasp.rb
    Library/Formula/dateutils.rb
    Library/Formula/debianutils.rb
    Library/Formula/etl.rb
    Library/Formula/git-ftp.rb
    Library/Formula/gst-libav.rb
    Library/Formula/gst-plugins-bad.rb
    Library/Formula/gst-plugins-base.rb
    Library/Formula/gst-plugins-good.rb
    Library/Formula/gst-plugins-ugly.rb
    Library/Formula/html-xml-utils.rb
    Library/Formula/htmlcleaner.rb
    Library/Formula/jpeg.rb
    Library/Formula/ktoblzcheck.rb
    Library/Formula/libxmp.rb
    Library/Formula/moreutils.rb
    Library/Formula/mp3cat.rb
    Library/Formula/nginx.rb
    Library/Formula/nimrod.rb
    Library/Formula/node.rb
    Library/Formula/num-utils.rb
    Library/Formula/osxutils.rb
    Library/Formula/patchutils.rb
    Library/Formula/plotutils.rb
    Library/Formula/pulse.rb
    Library/Formula/qemu.rb
    Library/Formula/recutils.rb
    Library/Formula/s-lang.rb
    Library/Formula/shadowsocks-libev.rb
    Library/Formula/synfig.rb
    Library/Formula/synfigstudio.rb
    Library/Formula/tor.rb
    Library/Formula/vala.rb
    Library/Formula/xml-coreutils.rb
    Library/Formula/xmp.rb
    Library/Formula/xz.rb
    Library/Formula/yasm.rb
    Library/Formula/youtube-dl.rb
    Library/Formula/zsh-syntax-highlighting.rb
    Library/Homebrew/cmd/audit.rb
    Library/Homebrew/cmd/man.rb
    Library/Homebrew/cmd/pull.rb
    Library/Homebrew/cmd/test-bot.rb
    Library/Homebrew/cmd/tests.rb
    Library/Homebrew/formula_versions.rb
    Library/Homebrew/formulary.rb
    Library/Homebrew/test/fixtures/test.mp3
    Library/Homebrew/utils.rb
    share/doc/homebrew/Maintainer-Guidelines.md
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
    Library/Aliases/nim
    Library/Formula/id3ed.rb
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

The only out of the vaguely out of the ordinary things I have done lately are tapping the repository Caskroom/cask and unlinking the phantomjs formula.

fxstein commented 9 years ago

@mikemcquaid First of all thank you for the fast reply!

The reason I replied to the problem in the first place: I don't recall making any changes to any of the formulae as this is a read only worker node. I will do some more research as to why this could have happened.

bennettallen commented 9 years ago

@mikemcquaid

When I run git reset --hard origin/master if get the following: error: unable to unlink old 'Library/Homebrew/manpages/brew.1.md' (Permission denied) fatal: Could not reset index file to revision 'origin/master'.

jacknagel commented 9 years ago
cd $(brew --repository)
sudo chown -R $USER .
git reset --hard origin/master
brew update
fxstein commented 9 years ago

@jacknagel Thank you! That fixed it for me as well.

benpptung commented 9 years ago

@jacknagel I follow your instruction cd $(brew --repository), and go to /usr/local directory. Is this directory for homebrew?

I use $ git status and see the modified file README.md , and noticed it was modified by Node.js, because I use $ git diff README.md.

The current README.md is completely the README.md of Node.js, and previously was Homebrew's README.md. Don't understand why both of Homebrew and Node.js want to put README.md file on /usr/local/?

Thank you again for your help, and can you explain Homebrew need to have a /usr/local/README.md?

lucygeneric commented 9 years ago

@jacknagel thanks dude.