Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error when brew updating, unable to unlink old README.md? #2906

Closed
chrispoole643 opened this Issue · 12 comments

9 participants

@chrispoole643

I ran brew update, and got this error message:

remote: Counting objects: 292, done.
remote: Compressing objects: 100% (233/233), done.
remote: Total 239 (delta 165), reused 0 (delta 0)
Receiving objects: 100% (239/239), 31.34 KiB, done.
Resolving deltas: 100% (165/165), completed with 45 local objects.
From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: unable to unlink old 'README.md' (Permission denied)
Updating 959edff..6cf7c80
Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master

Trying the command again, I get:

From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
        share/man/man1/brew.1
        Library/Homebrew/formula_installer.rb
        Library/Formula/xpdf.rb
        Library/Formula/wine.rb
        Library/Formula/webalizer.rb
        Library/Formula/tofrodos.rb
        Library/Formula/ssldump.rb
        Library/Formula/squirrel.rb
        Library/Formula/sphinx.rb
        Library/Formula/sleepnow.rb
        Library/Formula/skipfish.rb
        Library/Formula/schroedinger.rb
        Library/Formula/rebar.rb
        Library/Formula/rabbitmq.rb
        Library/Formula/qdbm.rb
        Library/Formula/pure.rb
        Library/Formula/pkg-config.rb
        Library/Formula/parallel.rb
        Library/Formula/openvpn.rb
        Library/Formula/mcl.rb
        Library/Formula/lilypond.rb
        Library/Formula/libvirt.rb
        Library/Formula/libsamplerate.rb
        Library/Formula/libao.rb
        Library/Formula/ledit.rb
        Library/Formula/jack.rb
        Library/Formula/gst-plugins-good.rb
        Library/Formula/geeqie.rb
        Library/Formula/freealut.rb
        Library/Formula/fontforge.rb
        Library/Formula/ddclient.rb
        Library/Formula/ddate.rb
        Library/Formula/d-bus.rb
        Library/Formula/cscope.rb
        Library/Formula/cppdom.rb
        Library/Formula/celt.rb
        Library/Formula/cd-discid.rb
        Library/Formula/cairomm.rb
        Library/Formula/bsdiff.rb
        Library/Contributions/manpages/brew.1.md
        Library/Contributions/examples/brew-audit.rb
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
        Library/Formula/zookeeper.rb
        Library/Formula/zdelta.rb
        Library/Formula/vip.rb
        Library/Formula/vcodex.rb
        Library/Formula/sshfs-fuse.rb
        Library/Formula/nickle.rb
        Library/Formula/isc-dhcp.rb
        Library/Formula/gst-plugins-ugly.rb
        Library/Formula/gst-plugins-bad.rb
        Library/Formula/go-gui.rb
        Library/Formula/fluxus.rb
        Library/Formula/exodriver.rb
        Library/Formula/djvulibre.rb
        Library/Formula/cdrdao.rb
        Library/Formula/c10t.rb
        Library/Formula/blahtexml.rb
        Library/Formula/bigloo.rb
        Library/Formula/aws-iam-tools.rb
        Library/Formula/aget.rb
        Library/Aliases/sshfs
        Library/Aliases/liblabjackusb
Please move or remove them before you can merge.
Updating 959edff..6cf7c80
Aborting
Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master

I'm not sure what to do, to get back to simply pulling from mxcl/homebrew.

@mikemcquaid
Owner

sudo chown -R `whoami` /usr/local
cd /usr/local
git reset --hard origin/master

That'll reset you to the upstream version and fix your bad permissions.

@chrispoole643

Thanks.

I tried git reset --hard origin/master, but it didn't work (fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.),

I then tried git reset --hard master, which worked, but after performing brew update again, I still get

From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
        Library/Formula/zookeeper.rb
        Library/Formula/zdelta.rb
        Library/Formula/vip.rb
        Library/Formula/vcodex.rb
        Library/Formula/sshfs-fuse.rb
        Library/Formula/nickle.rb
        Library/Formula/isc-dhcp.rb
        Library/Formula/gst-plugins-ugly.rb
        Library/Formula/gst-plugins-bad.rb
        Library/Formula/go-gui.rb
        Library/Formula/fluxus.rb
        Library/Formula/exodriver.rb
        Library/Formula/djvulibre.rb
        Library/Formula/cdrdao.rb
        Library/Formula/c10t.rb
        Library/Formula/blahtexml.rb
        Library/Formula/bigloo.rb
        Library/Formula/aws-iam-tools.rb
        Library/Formula/aget.rb
        Library/Aliases/sshfs
        Library/Aliases/liblabjackusb
Please move or remove them before you can merge.
Updating 959edff..6cf7c80
Aborting
Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master
@Sheeo

I had this bug aswell, but I do not want to chown my /usr/local directory.

Is there no other workaround?

@mikemcquaid
Owner

@Sheeo: It's not a bug if you're not chowning, you're not using the software as instructed and intended.
@chrispoole643: Try git pull --force, that will force overwriting.

@chrispoole643

@mikemcquaid: that didn't work, for some reason (git pull --force http://github.com/mxcl/homebrew.git master).

So, I resolved the issue (I hope!) by removing the files it mentioned in my last comment in this thread. Then running git pull --force worked, adding these files again.

I'm not really sure what the issue was (I stick to the most standard install of Homebrew I can, for this reason), but it seems to be fixed now.

Thanks.

@mikemcquaid
Owner

@chrispoole643: For future reference, that's bad syntax for using git pull. Read the manpage and follow the syntax exactly next time. Glad it's fixed though!

@ctwise

Something changed the permissions on the /usr/local directory. Likely an Apple software update or some other software installation. Make the /usr/local directory writeable to your account again.

@christophercotton

It happened to me when updating to OSX Lion. How about adding a check to the permissions on /usr/local and warning the user of what to do. The problem is that the /usr/local is now owned by root/staff:

: ls -l /usr/
drwxrwxr-x    12 root  staff    408 Jul 27 08:46 local/
@alexch

btw after the recommended

sudo chown -R `whoami` /usr/local

an easy way to remove the files it's complaining about (the partial update) is

cd /usr/local
git add .
git stash
git reset --hard

and then

brew update

should work. (git reset --hard wasn't removing the files for me.)

@mariusbutuc

Why not just a non-destructive and simple:

cd /usr/local
git checkout -- .
brew update
@jrgcubano
cd /usr/local
git fetch origin
git reset --hard origin/master

@GitMoIO

sudo chown -R whoami /usr/local worked for me. Thanks.

@mistydemeo mistydemeo locked and limited conversation to collaborators
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Something went wrong with that request. Please try again.