Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

brew update fails #5128

Closed
lgw4 opened this issue Apr 10, 2011 · 81 comments
Closed

brew update fails #5128

lgw4 opened this issue Apr 10, 2011 · 81 comments

Comments

@lgw4
Copy link

lgw4 commented Apr 10, 2011

Attempted to install Homebrew on a new machine today. brew update failed.

[lgw4@mike:~]$ ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...

Press enter to continue
==> /usr/bin/sudo /bin/mkdir /usr/local
==> /usr/bin/sudo /bin/chmod g+w /usr/local
==> /usr/bin/sudo /usr/bin/chgrp staff /usr/local
==> Downloading and Installing Homebrew...
==> Installation successful!
[lgw4@mike:~]$ brew install git
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.4.4.tar.bz2
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.4.4 install
==> Downloading http://kernel.org/pub/software/scm/git/git-manpages-1.7.4.4.tar.bz2
######################################################################## 100.0%
==> Downloading http://kernel.org/pub/software/scm/git/git-htmldocs-1.7.4.4.tar.bz2
######################################################################## 100.0%
==> Caveats
Bash completion and emacs support have been installed.

The rest of the "contrib" folder has been copied to:
  /usr/local/Cellar/git/1.7.4.4/share/contrib
==> Summary
/usr/local/Cellar/git/1.7.4.4: 1054 files, 19M, built in 43 seconds
[lgw4@mike:~]$ brew update

Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 35243, done.
remote: Compressing objects: 100% (16168/16168), done.
remote: Total 35243 (delta 20557), reused 31835 (delta 18515)
Receiving objects: 100% (35243/35243), 4.78 MiB | 1.24 MiB/s, done.
Resolving deltas: 100% (20557/20557), done.
From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: Untracked working tree file '.gitignore' would be overwritten by merge.

Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master
[lgw4@mike:~]$ brew update
error: The following untracked working tree files would be overwritten by checkout:
    .gitignore
    Library/Aliases/0mq
    Library/Aliases/Secret Rabbit Code
    Library/Aliases/alut
    Library/Aliases/android
    Library/Aliases/apache-activemq
    Library/Aliases/apache-fop
    Library/Aliases/aws-as
    Library/Aliases/aws-mon
    Library/Aliases/beanstalkd
    Library/Aliases/bjam
    Library/Aliases/bzr
    Library/Aliases/cowthink
    Library/Aliases/cpanm
    Library/Aliases/ctags-exuberant
    Library/Aliases/db
    Library/Aliases/dbus
    Library/Aliases/dejagnu
    Library/Aliases/eyeD3
    Library/Aliases/firefly
    Library/Aliases/fluidsynth
    Library/Aliases/fsa
    Library/Aliases/gearmand
    Library/Aliases/gnu-scientific-library
    Library/Aliases/google-go
    Library/Aliases/gs
    Library/Aliases/gtk
    Library/Aliases/gtypist
    Library/Aliases/hudson
    Library/Aliases/hugs
    Library/Aliases/ipsum
    Library/Aliases/jocr
    Library/Aliases/jslint
    Library/Aliases/lcms
    Library/Aliases/leg
    Library/Aliases/libav
    Library/Aliases/libcryptopp
    Library/Aliases/libgd
    Library/Aliases/libgeoip
    Library/Aliases/libjpeg
    Library/Aliases/libjpg
    Library/Aliases/liblabjackusb
    Library/Aliases/libmad
    Library/Aliases/libmcrypt
    Library/Aliases/liboggz
    Library/Aliases/libqrencode
    Library/Aliases/libtag
    Library/Aliases/libtasn
    Library/Aliases/mc
    Library/Aliases/mikmod
    Library/Aliases/mongo
    Library/Aliases/mp4box
    Library/Aliases/node.js
    Library/Aliases/nsis
    Library/Aliases/o-caml
    Library/Aliases/ocaml
    Library/Aliases/omake
    Library/Aliases/ooc
    Library/Aliases/openocd
    Library/Aliases/p4
    Library/Aliases/p4d
    Library/Aliases/pipeviewer
    Library/Aliases/pkgconfig
    Library/Aliases/postgres
    Library/Aliases/rbx
    Library/Aliases/ree
    Library/Aliases/saga
    Library/Aliases/shell-fm
    Library/Aliases/slang
    Library/Aliases/stax-sdk
    Library/Aliases/style
    Library/Aliases/svn
    Library/Aliases/ultima4
    Library/Aliases/ultima7
    Library/Aliases/umfpack
    Library/Aliases/urxvt
    Library/Aliases/usb-multiplex-daemon
    Library/Aliases/zmq
    Library/Contributions/brew_bash_completion.sh
    Library/Contributions/brew_fish_completion.fish
    Library/Contributions/brew_zsh_completion.zsh
    Library/Contributions/examples/brew-bottle.rb
    Library/Contributions/examples/brew-depstree.rb
    Library/Contributions/examples/brew-dirty.rb
    Library/Contributions/examples/brew-graph
    Library/Contributions/examples/brew-grep
    Library/Contributions/examples/brew-leaves.rb
    Library/Contributions/examples/brew-linkapps.rb
    Library/Contributions/examples/brew-man
    Library/Contributions/examples/brew-missing.rb
    Library/Contributions/examples/brew-pull.rb
    Library/Contributions/examples/brew-readall.rb
    Library/Contributions/examples/brew-server
    Library/Contributions/examples/brew-switch.rb
    Library/Contributions/examples/brew-upgrade.rb
    Library/Contributions/examples/brew-which.rb
    Library/Contributions/manpages/brew-man.1.md
    Library/Contributions/manpages/brew.1.md
    Library/Formula/a2ps.rb
    Library/Formula/a52dec.rb
    Library/Formula/aacgain.rb
    Library/Formula/aalib.rb
    Library/Formula/aamath.rb
    Library/Formula/aardvark_shell_utils.rb
    Library/Formula/abcde.rb
    Library/Formula/abfind.rb
    Library/Formula/abiword.rb
    Library/Formula/abnfgen.rb
    Library/Formula/abook.rb
    Library/Formula/abuse.rb
    Library/Formula/ack.rb
    Library/Formula/activemq.rb
    Library/Formula/adamem.rb
    Library/Formula/adobe-air-sdk.rb
    Library/Formula/adplug.rb
    Library/Formula/advancecomp.rb
    Library/Formula/aescrypt.rb
    Library/Formula/afflib.rb
    Library/Formula/afsctool.rb
    Library/Formula/aften.rb
    Library/Formula/aget.rb
    Library/Formula/aggregate.rb
    Library/Formula/agrep.rb
    Library/Formula/aircrack-ng.rb
    Library/Formula/akonadi.rb
    Library/Formula/aldo.rb
    Library/Formula/algol68g.rb
    Library/Formula/alpine.rb
    Library/Formula/android-ndk.rb
    Library/Formula/android-sdk.rb
    Library/Formula/angband.rb
    Library/Formula/ansifilter.rb
    Library/Formula/antiword.rb
    Library/Formula/antlr.rb
    Library/Formula/aoeui.rb
    Library/Formula/apachetop.rb
    Library/Formula/apc.rb
    Library/Formula/apg.rb
    Library/Formula/apgdiff.rb
    Library/Formula/aplus.rb
    Library/
Aborting
Error: Failure while executing: git checkout -q master 
[lgw4@mike:~]$

brew doctor is fine.

[lgw4@mike:~]$ brew doctor
Your OS X is ripe for brewing.
Any troubles you may be experiencing are likely purely psychosomatic.
[lgw4@mike:~]$ 

brew --env and brew --config look fine, too.

[lgw4@mike:~]$ brew --env ; brew --config
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
MAKEFLAGS: -j2
HOMEBREW_VERSION: 0.8
HEAD: ce00963228188ba7c0475646a450c3d06bf48a99
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: dual-core 64-bit penryn
OS X: 10.6.7
Kernel Architecture: i386
Ruby: 1.8.7-174
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 3.2.6
GCC-4.0: build 5494 
GCC-4.2: build 5666 
LLVM: build 2335 
MacPorts or Fink? false
X11 installed? true
[lgw4@mike:~]$ 
@ghost
Copy link

ghost commented Apr 10, 2011

This is a fresh install?

$ cd /usr/local

$ git fetch origin

$ git reset --hard origin/master

Can you tell how this outputs?

@lgw4
Copy link
Author

lgw4 commented Apr 10, 2011

[lgw4@mike:~]$ cd /usr/local/
[lgw4@mike:local]$ git fetch origin
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
[lgw4@mike:local]$ git reset --hard origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
[lgw4@mike:local]$ 

@ghost
Copy link

ghost commented Apr 10, 2011

$ cd /usr/local/

$ git remote add origin git://github.com/mxcl/homebrew.git

Then run the above.

@lgw4
Copy link
Author

lgw4 commented Apr 11, 2011

This seems to have fixed the problem.

[lgw4@mike:local]$ git remote add origin git://github.com/mxcl/homebrew.git
[lgw4@mike:local]$ git fetch origin
remote: Counting objects: 50, done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 46 (delta 15), reused 37 (delta 9)
Unpacking objects: 100% (46/46), done.
From git://github.com/mxcl/homebrew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      master     -> origin/master
[lgw4@mike:local]$ git reset --hard origin/master
HEAD is now at aff8ce3 Gearmand 0.20
[lgw4@mike:local]$ brew update
From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Any idea what caused the problem?

@ghost
Copy link

ghost commented Apr 11, 2011

Sorry, I really don't. Maybe something broke the installation before it finished.

@lgw4 lgw4 closed this as completed Apr 11, 2011
@samueljohn
Copy link
Contributor

Well, I'd like to re-open. I have a fresh install (deleted /usr/local completely) and the same issue.
And Igw4's hint fixed the problem for me too. You can easily try that by mv your /usr/local to /usr/__my_precious_local and set up an new brew as described on the homepage.

samuel@localhost:~ $ ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...

Press enter to continue
==> /usr/bin/sudo /bin/mkdir /usr/local
==> /usr/bin/sudo /bin/chmod g+w /usr/local
==> /usr/bin/sudo /usr/bin/chgrp staff /usr/local
==> Downloading and Installing Homebrew...
==> Installation successful!
samuel@localhost:~ $ brew update
Please `brew install git' first.
samuel@localhost:~ $ brew install git
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.4.4.tar.bz2
File already downloaded and cached to /Users/samuel/Library/Caches/Homebrew
==> make prefix=/usr/local/Cellar/git/1.7.4.4 install
==> Downloading http://kernel.org/pub/software/scm/git/git-manpages-1.7.4.4.tar.
File already downloaded and cached to /Users/samuel/Library/Caches/Homebrew
==> Downloading http://kernel.org/pub/software/scm/git/git-htmldocs-1.7.4.4.tar.
File already downloaded and cached to /Users/samuel/Library/Caches/Homebrew
==> Caveats
Bash completion and emacs support have been installed.

The rest of the "contrib" folder has been copied to:
/usr/local/Cellar/git/1.7.4.4/share/contrib
==> Summary
/usr/local/Cellar/git/1.7.4.4: 1054 files, 19M, built in 68 seconds
samuel@localhost:~ $ brew update

Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 35417, done.
remote: Compressing objects: 100% (16342/16342), done.
remote: Total 35417 (delta 20687), reused 31821 (delta 18515)
Receiving objects: 100% (35417/35417), 4.83 MiB | 213 KiB/s, done.
Resolving deltas: 100% (20687/20687), done.
From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: Untracked working tree file '.gitignore' would be overwritten by merge.

Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master
samuel@localhost:~ $ cd /usr/local
samuel@localhost:/usr/local $ brew update
error: The following untracked working tree files would be overwritten by checkout:
.gitignore
Library/Aliases/0mq
Library/Aliases/Secret Rabbit Code
 [snip]

@adamv adamv reopened this Apr 12, 2011
@amarshall
Copy link
Contributor

@samueljohn by "deleted /usr/local completely" do you mean deleted all its contents or deleted the actual folder?

@samueljohn
Copy link
Contributor

@amarshall I mean mv /usr/local /usr/__local, so there is no /usr/local

@lgw4
Copy link
Author

lgw4 commented Apr 12, 2011

I agree this is still happening. I tried another fresh Homebrew install on a fresh 10.6.7 install with Xcode 3.2.6 and am still seeing this error. Sure, the steps given by MindTooth above fix the problem, but the problem persists. Might make someone give up and go back to MacPorts (okay, sorry for the troll bait, but still…).

@lgw4 lgw4 closed this as completed Apr 12, 2011
@lgw4 lgw4 reopened this Apr 12, 2011
@samueljohn
Copy link
Contributor

@Igw4: Indeed, I am coming from MacPorts and I think homebrew is really cool (and the first reason to learn about ruby, even if I am a python lover).

@lombers
Copy link

lombers commented Apr 13, 2011

This issue has also happened for me on 10.6.7 and xcode 3.2.6 on a fresh install. The above steps posted seem to fix the issue...

@adamv
Copy link
Contributor

adamv commented Apr 13, 2011

If this is happening in fresh installs, the "brew update" is probably broken in some way, and the other maintainers will need to jump in.

(I don't use "brew update" personally, I always get fetch.)

@digitalcardboard
Copy link

Happened to me twice, once on a MacBook w/ 10.6.7., another on a Hackintosh with 10.6.6. Both coming from MacPorts, if that makes any difference. Adding the origin repo manually seems to have fixed it, but it's a little funky. Otherwise things are working great!

@adamv
Copy link
Contributor

adamv commented Apr 13, 2011

@MikeMcQuaid @mxcl - something fishy here? I don't use "brew update" so I dunno.

@digitalcardboard
Copy link

@adamv if you don't use 'brew update' then what do you use? All the docs I'm reading show that command, and I'm a junkie for updates. So far, it's still much better than that other package manager, but the extra setup to get updates to work is kinda funky.

@MikeMcQuaid
Copy link
Member

I never really use brew update either. I just use git pull instead. Perhaps we should encourage Xcode 4 people (which these guys aren't) to just do a git checkout. I guess @mxcl would know best about the installation script.

@samueljohn
Copy link
Contributor

I dont have Xcode 4.
But I have had that issue.
I think brew update is important to work, because it is more convenient, clear and important for non git power-users.

@digitalcardboard
Copy link

@samueljohn Agreed, it's much clearer.

The install script (per the wiki) doesn't initialize a .git (understandably, because we may not have git installed at that point) so when brew update is run for the first time, it complains about all them untracked working tree files. I'd love for the brew doctor to be able to make these kinds of boo-boos better.

For the time being, I've linked the wiki to this issue, so that other people are aware.

@jacknagel
Copy link
Contributor

re: the installer not doing a git init, perhaps in the future, when Xcode 4 is a bit more widespread, the install instructions could suggest that Xcode be installed first, and then the installer could safely run git commands since git is included in the Xcode 4 package. Just a thought.

@samueljohn
Copy link
Contributor

@jacknagel: Sure, but Xcode 4 costs (a bit).
The issue here is not directly related to a missing git, because I first did a brew install git and then brew update if no /usr/local is there at all.

@jacknagel
Copy link
Contributor

Right. But the installer script just untars the homebrew tarball into /usr/local, and as @digitalcardboard noted, when brew update is run for the first time, it runs git init, and then after pulling down from the github repo it tries to checkout the master branch which results in all the conflicts that you are seeing. If there was a system git (as there is with XCode 4 pre-installed), it could be used for the main installation and installing from the tarball could be a fallback.

(Aside: Like you said, XCode 4 isn't free but I have a feeling it might still be included on the Lion install discs, and only cost for people who get Lion via the App Store. Either way, eventually it will become the norm for devs to have XCode 4, or another way of getting the toolchain will emerge.)

Edit: my point related to this issue is that brew update should probably make git ignore the fact that it is overwriting a bunch of files in /usr/local when it tries to checkout master for the first time.

@ghost
Copy link

ghost commented Apr 24, 2011

Well, this is pretty annoying. Because I actually am not able to get homebrew fully working at the moment. I only discovered this issue after deciding to reinstall because of another problem which I can now reproduce and I think might be related to this one.

The steps (add remote, fetch, hard reset) to fix the failing update do work, but at least for me have a nasty side effect. After applying them, whenever I run brew info on any formula (I tried a dozen, both ones I have installed and ones I never before did anything with), the URL in the last line, which should be

http://github.com/mxcl/homebrew/commits/master/Library/Formula/...

is instead returned as

http://github.com/matrixagent/homebrew/commits/master/Library/Formula/...

i.e. it has my github username instead of @mxcl's and of course it does not exist.

brew install works fine, but still, not being able to use brew info --url is pretty annyoing, and the whole thing just feels horribly broken.

I have never forked homebrew, so I have not the slightest idea why this is happening.
The reason why I decided reinstalling homebrew was because all of a sudden all the URLs were wrong. So this also happened without the clean install ahead, I can't exactly say when or how, however.

As I said, this is reproducable. I also moved my old /usr/local away so that it didn't even exist before installing homebrew.
Directly after installing, brew info gives the correct URL, but update will fail. After applying the fixing steps from this thread, brew update will work, but all formulae have the wrong URL. I retried this 3 times, same result every time.

10.6.7, latest Xcode 3. I never had MacPorts or anything else on this system.

@jacknagel
Copy link
Contributor

It looks to me like the info command is broken, as it is putting together the url by looking for a username in your global git config. Didn't notice it until now, but the exact same thing happens on my installation.

@ghost
Copy link

ghost commented Apr 25, 2011

Would be weird however that this only started happening a few days ago then. Was brew info modified?
A friend of mine who also has his username set in his global git config can't reproduce it.

@jacknagel
Copy link
Contributor

Yeah, it's weird. On first glance I'm not even sure why brew info needs to know my github username, but it does default to mxcl if it can't locate github.user in the global .gitconfig (i.e., if I comment out that line in my gitconfig it provides the correct links).

Looking at the history, that bit of code has been there at least since refactor was merged, if not before.

@jacknagel
Copy link
Contributor

@adamv: can you provide some insight here re: brew info?

@soupmatt
Copy link
Contributor

Try the fix here: #5128 (comment)

@mxcl
Copy link
Contributor

mxcl commented Jun 15, 2011

OK, so for further information. This started happening with Git 1.7.4 or 1.7.5, as it doesn't happen with the Xcode 4 provided Git which is 1.7.3.

@mxcl mxcl closed this as completed in 8bec9b1 Jun 15, 2011
@mxcl
Copy link
Contributor

mxcl commented Jun 15, 2011

Those still suffering can:

git fetch git://github.com/mxcl/homebrew.git
git reset FETCH_HEAD
brew update

@dtan
Copy link

dtan commented Jun 16, 2011

i followed brew doctors instructions and made sure these folders were chowned under my user (but left the group the same):

/usr/local/include
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1

@cschep
Copy link
Contributor

cschep commented Aug 3, 2011

This exact thing happened to me today on a fresh install of Lion from a restore disc. Xcode 4.1 installed, ran the default install instructions, brew update exploded. Should this be reopened?

@dylanvee
Copy link
Contributor

dylanvee commented Aug 3, 2011

@cschep, I had the exact same experience as you. Unfortunately I forget exactly what I did to fix it.

@cschep
Copy link
Contributor

cschep commented Aug 3, 2011

@dylanvee I did the following that was suggested above:

cd brew --prefix
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master

I had to sudo the git reset command though.. too weird.

@mxcl
Copy link
Contributor

mxcl commented Aug 3, 2011

No, it was a different bug, which we fixed yesterday. if after a working update it persists please open a new ticket.

@idev
Copy link

idev commented Aug 7, 2011

Don't know if this also is noteworthy, I had the same issue but was on git 1.6.2, updated git to the latest version and now brew update works for me.

@dylanvee
Copy link
Contributor

dylanvee commented Aug 8, 2011

@idev I had this issue after installing Homebrew and then using it to install the latest git.

Sharpie pushed a commit to Sharpie/homebrew that referenced this issue Sep 19, 2011
Behaviour for git checkout was changed such that the update would fail because it refused to checkout files on to existing files in the working directory.

This was bad behaviour anyway, we should make efforts to keep any local modifications to the Homebrew checkout. Everything is neatly resolved if we just do a --soft reset.

Closes Homebrew#6017.
etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 27, 2011
Behaviour for git checkout was changed such that the update would fail because it refused to checkout files on to existing files in the working directory.

This was bad behaviour anyway, we should make efforts to keep any local modifications to the Homebrew checkout. Everything is neatly resolved if we just do a --soft reset.

Closes Homebrew#6017.
@conatus
Copy link

conatus commented Jan 7, 2012

Permission fix fixed this for me.

sudo chown -R $USER /usr/local' - as above.

Before that I blundered through the git fetch routine.

@martyvona
Copy link

I was seeing similar issues with brew update failing; for me this appears to have been due to using an old 1.6.x version of git, which apparently has compatibility issues now with github when using http (403 errors). The trick was that I had installed git via brew. This is what worked for me

cd `brew --prefix`
rm -rf .git
git remote add origin git://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master
brew update
brew install git

@bhox
Copy link

bhox commented Apr 13, 2012

martyvona's solution worked for me, with one additional line: after rm -rf .git, you need to initialize git with:
git init

@stonegao
Copy link

Fresh install on Mac OS X 10.8 still fails

ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)

remote: Counting objects: 77266, done.
remote: Compressing objects: 100% (37198/37198), done.
remote: Total 77266 (delta 52645), reused 61373 (delta 39257)
Receiving objects: 100% (77266/77266), 10.99 MiB | 798 KiB/s, done.
Resolving deltas: 100% (52645/52645), done.
From https://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: Untracked working tree file '.gitignore' would be overwritten by merge.
Failed during: xcrun git pull origin master

@jasonbosco
Copy link

@stonegao It's a permission issue. /usr/local should be owned by the current user.

$ sudo chown -R $USER /usr/local

Remove existing installation (which just failed):

$ rm -rf /usr/local/*
$ rm -rf /usr/local/.*

And then re-install

$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)

@mcandre
Copy link

mcandre commented Oct 1, 2012

@jasonbosco Thanks! Works for me!

Specs:

  • Homebrew
  • Mac OS X 10.8.2
  • MacBook Pro 2009

snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012
Behaviour for git checkout was changed such that the update would fail because it refused to checkout files on to existing files in the working directory.

This was bad behaviour anyway, we should make efforts to keep any local modifications to the Homebrew checkout. Everything is neatly resolved if we just do a --soft reset.

Closes Homebrew#6017.
@snez
Copy link

snez commented Aug 29, 2013

cd /usr/local
git reset head --hard
git clean -f
brew update <- will work

@ShujiaHuang
Copy link

Thanks @snez your suggestion is work!

@ciaranarcher
Copy link

+1 @snez

@scottspeidel
Copy link

This worked for me:

$ cd `brew --prefix`
$ git remote add origin https://github.com/Homebrew/homebrew.git
$ git fetch origin
$ git reset --hard origin/master
$ brew update

Already up-to-date.

found here: http://stackoverflow.com/questions/9370552/brew-update-failure-while-executing-git-checkout

@Homebrew Homebrew locked and limited conversation to collaborators Aug 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests