This repository has been archived by the owner. It is now read-only.

brew update fails #5128

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

Comments

Projects
None yet
@lgw4

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost 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?

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

This comment has been minimized.

Show comment Hide comment
@lgw4

lgw4 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]$ 

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Apr 10, 2011

$ cd /usr/local/

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

Then run the above.

ghost commented Apr 10, 2011

$ cd /usr/local/

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

Then run the above.

@lgw4

This comment has been minimized.

Show comment Hide comment
@lgw4

lgw4 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?

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Apr 11, 2011

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

ghost commented Apr 11, 2011

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

@lgw4 lgw4 closed this Apr 11, 2011

@samueljohn

This comment has been minimized.

Show comment Hide comment
@samueljohn

samueljohn Apr 12, 2011

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]
Contributor

samueljohn commented Apr 12, 2011

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

This comment has been minimized.

Show comment Hide comment
@amarshall

amarshall Apr 12, 2011

Contributor

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

Contributor

amarshall commented Apr 12, 2011

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

@samueljohn

This comment has been minimized.

Show comment Hide comment
@samueljohn

samueljohn Apr 12, 2011

Contributor

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

Contributor

samueljohn commented Apr 12, 2011

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

@lgw4

This comment has been minimized.

Show comment Hide comment
@lgw4

lgw4 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 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 Apr 12, 2011

@lgw4 lgw4 reopened this Apr 12, 2011

@samueljohn

This comment has been minimized.

Show comment Hide comment
@samueljohn

samueljohn Apr 12, 2011

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).

Contributor

samueljohn commented Apr 12, 2011

@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

This comment has been minimized.

Show comment Hide comment
@lombers

lombers 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...

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

This comment has been minimized.

Show comment Hide comment
@adamv

adamv Apr 13, 2011

Contributor

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.)

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

This comment has been minimized.

Show comment Hide comment
@digitalcardboard

digitalcardboard Apr 13, 2011

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!

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

This comment has been minimized.

Show comment Hide comment
@adamv

adamv Apr 13, 2011

Contributor

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

Contributor

adamv commented Apr 13, 2011

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

@digitalcardboard

This comment has been minimized.

Show comment Hide comment
@digitalcardboard

digitalcardboard Apr 13, 2011

@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.

@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

This comment has been minimized.

Show comment Hide comment
@MikeMcQuaid

MikeMcQuaid Apr 13, 2011

Owner

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.

Owner

MikeMcQuaid commented Apr 13, 2011

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

This comment has been minimized.

Show comment Hide comment
@samueljohn

samueljohn Apr 13, 2011

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.

Contributor

samueljohn commented Apr 13, 2011

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

This comment has been minimized.

Show comment Hide comment
@digitalcardboard

digitalcardboard Apr 13, 2011

@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.

@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

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 13, 2011

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.

Contributor

jacknagel commented Apr 13, 2011

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

This comment has been minimized.

Show comment Hide comment
@samueljohn

samueljohn Apr 13, 2011

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.

Contributor

samueljohn commented Apr 13, 2011

@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

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 13, 2011

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.

Contributor

jacknagel commented Apr 13, 2011

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost 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.

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

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 24, 2011

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.

Contributor

jacknagel commented Apr 24, 2011

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost 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.

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

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 25, 2011

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.

Contributor

jacknagel commented Apr 25, 2011

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

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 25, 2011

Contributor

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

Contributor

jacknagel commented Apr 25, 2011

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

@adamv

This comment has been minimized.

Show comment Hide comment
@adamv

adamv Apr 25, 2011

Contributor

If someone has Homebrew forked, and is working in a branch, then "brew info" should show that branch rather than mxcl's upstream. Because otherwise a bug report might contain a link to a user-added formula that doesn't exist in mxcl.

But it's quite likely that there's a bug in the current code. Except that it ought not matter for brew update, which is what the original bug title is about here.

Contributor

adamv commented Apr 25, 2011

If someone has Homebrew forked, and is working in a branch, then "brew info" should show that branch rather than mxcl's upstream. Because otherwise a bug report might contain a link to a user-added formula that doesn't exist in mxcl.

But it's quite likely that there's a bug in the current code. Except that it ought not matter for brew update, which is what the original bug title is about here.

@adamv

This comment has been minimized.

Show comment Hide comment
@adamv

adamv Apr 25, 2011

Contributor

But again, I don't use brew update personally, so I'm not sure what the problem/fix here is.

Contributor

adamv commented Apr 25, 2011

But again, I don't use brew update personally, so I'm not sure what the problem/fix here is.

@jacknagel

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 25, 2011

Contributor

I think the issue with brew update is that when it is executed for the first time, it runs git init and then git pull from mxcl/master. But the installer script just unpacks the tarball into /usr/local, so when git pull is executed, there are a bunch of untracked files in the way.

Correct me if I'm wrong on any of that.

As far as brew info, the current code uses github.user even if that person has never forked Homebrew. So that probably warrants an issue of its own.

Contributor

jacknagel commented Apr 25, 2011

I think the issue with brew update is that when it is executed for the first time, it runs git init and then git pull from mxcl/master. But the installer script just unpacks the tarball into /usr/local, so when git pull is executed, there are a bunch of untracked files in the way.

Correct me if I'm wrong on any of that.

As far as brew info, the current code uses github.user even if that person has never forked Homebrew. So that probably warrants an issue of its own.

@ghost ghost assigned mxcl Apr 25, 2011

@digitalcardboard

This comment has been minimized.

Show comment Hide comment
@digitalcardboard

digitalcardboard Apr 25, 2011

@jacknagel That's what I see as well (re: the original brew update issue)

Running git fetch origin isn't documented anywhere for the casual user, doesn't give the info about new/updated formulae, and can't be ran ran until you've got a git repo locally anyway.

@jacknagel That's what I see as well (re: the original brew update issue)

Running git fetch origin isn't documented anywhere for the casual user, doesn't give the info about new/updated formulae, and can't be ran ran until you've got a git repo locally anyway.

@wondersloth

This comment has been minimized.

Show comment Hide comment
@wondersloth

wondersloth Apr 26, 2011

I had this problem and this thread fixed it. Thanks!

I had this problem and this thread fixed it. Thanks!

@UniK

This comment has been minimized.

Show comment Hide comment
@UniK

UniK Apr 27, 2011

@wondersloth
Can you provide information on how exactly you've solved this issue?

UniK commented Apr 27, 2011

@wondersloth
Can you provide information on how exactly you've solved this issue?

@MikeMcQuaid

This comment has been minimized.

Show comment Hide comment
@MikeMcQuaid

MikeMcQuaid Apr 27, 2011

Owner

I think we need to fix the installer. @mxcl, thoughts?

Owner

MikeMcQuaid commented Apr 27, 2011

I think we need to fix the installer. @mxcl, thoughts?

@burfield

This comment has been minimized.

Show comment Hide comment
@burfield

burfield Apr 28, 2011

I'm having this same issue. @wondersloth can you comment on what you did to fix it? I have followed the steps above and I'm still having the same problem.

I'm having this same issue. @wondersloth can you comment on what you did to fix it? I have followed the steps above and I'm still having the same problem.

@jacknagel

This comment has been minimized.

Show comment Hide comment
@jacknagel

jacknagel Apr 28, 2011

Contributor

@burfield: What happens if you do:

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

and then run brew update?

Contributor

jacknagel commented Apr 28, 2011

@burfield: What happens if you do:

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

and then run brew update?

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 23, 2011

Had this problem on a completely fresh install of OS X 10.6.7 as well. Many thanks to Mindtooth for the solution.

ghost commented May 23, 2011

Had this problem on a completely fresh install of OS X 10.6.7 as well. Many thanks to Mindtooth for the solution.

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 23, 2011

Glad I could be of service ;)

ghost commented May 23, 2011

Glad I could be of service ;)

@RyanBalfanz

This comment has been minimized.

Show comment Hide comment
@RyanBalfanz

RyanBalfanz May 31, 2011

@mwcmpbll, I can't complete any of the steps you suggested at mxcl#5128 (comment).

I think this is because I installed homebrew as my admin user (mxcl#5128 (comment)). Some of the files in /usr/local/.git are root:staff, some admin:staff and some ryan:staff.

Has anybody noticed any of the issues in this thread using an admin user and a regular user like I have? Is it not suggested to do so for any reason? My core issues seem (cannot brew update) related but I'm not sure if they're related.

@mwcmpbll, I can't complete any of the steps you suggested at mxcl#5128 (comment).

I think this is because I installed homebrew as my admin user (mxcl#5128 (comment)). Some of the files in /usr/local/.git are root:staff, some admin:staff and some ryan:staff.

Has anybody noticed any of the issues in this thread using an admin user and a regular user like I have? Is it not suggested to do so for any reason? My core issues seem (cannot brew update) related but I'm not sure if they're related.

@soupmatt

This comment has been minimized.

Show comment Hide comment
@soupmatt

soupmatt May 31, 2011

Contributor

Check out @MindTooth's fix for if you installed brew as root: mxcl#5128 (comment)

Contributor

soupmatt commented May 31, 2011

Check out @MindTooth's fix for if you installed brew as root: mxcl#5128 (comment)

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 31, 2011

Be aware! I've been noticed that my wonder command can make MySQL databases useless. Since they depend on mysql:mysql.

If you have MySQL databases under /usr/local before sure to CHOWN them back later.

ghost commented May 31, 2011

Be aware! I've been noticed that my wonder command can make MySQL databases useless. Since they depend on mysql:mysql.

If you have MySQL databases under /usr/local before sure to CHOWN them back later.

@fallwith

This comment has been minimized.

Show comment Hide comment
@fallwith

fallwith Jun 2, 2011

I too am still unable to use "brew update". Based on the (great!) information provided by this thread, I have created an alias. I can now successfully run "brewupdate" instead of "brew update".

alias brewupdate="opwd=`pwd` && cd `brew --prefix` && git init && git fetch https://github.com/mxcl/homebrew.git && git reset --hard FETCH_HEAD && cd $opwd"

fallwith commented Jun 2, 2011

I too am still unable to use "brew update". Based on the (great!) information provided by this thread, I have created an alias. I can now successfully run "brewupdate" instead of "brew update".

alias brewupdate="opwd=`pwd` && cd `brew --prefix` && git init && git fetch https://github.com/mxcl/homebrew.git && git reset --hard FETCH_HEAD && cd $opwd"
@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Jun 2, 2011

Another try:

$ cd brew --prefix
$ git init
$ git remote add -f -t master -m master origin git://github.com/mxcl/homebrew.git
$ git reset --hard origin/HEAD

ghost commented Jun 2, 2011

Another try:

$ cd brew --prefix
$ git init
$ git remote add -f -t master -m master origin git://github.com/mxcl/homebrew.git
$ git reset --hard origin/HEAD

@mecca831

This comment has been minimized.

Show comment Hide comment
@mecca831

mecca831 Jun 10, 2011

Same problem here after a clean install. I was googling for solutions yesterday and followed this article:
http://stackoverflow.com/questions/5440017/homebrew-is-generating-two-warnings

Just enter:

cd /usr/local && git reset --hard HEAD

Then brew update seems to work. Don't know if there's any side effect.

Same problem here after a clean install. I was googling for solutions yesterday and followed this article:
http://stackoverflow.com/questions/5440017/homebrew-is-generating-two-warnings

Just enter:

cd /usr/local && git reset --hard HEAD

Then brew update seems to work. Don't know if there's any side effect.

@victorhooi

This comment has been minimized.

Show comment Hide comment
@victorhooi

victorhooi Jun 14, 2011

Contributor

heya,

Hmm, I'm encoutering this issue as well:

192-168-1-29:local victorhooi$ brew update

Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 38403, done.
remote: Compressing objects: 100% (17202/17202), done.
remote: Total 38403 (delta 22941), reused 34248 (delta 20619)
Receiving objects: 100% (38403/38403), 5.30 MiB | 450 KiB/s, done.
Resolving deltas: 100% (22941/22941), 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

I then tried mecca831's instructions from above, and got an error about /usr/local/Cellar:

192-168-1-29:local victorhooi$ cd /usr/local && git reset --hard HEAD
HEAD is now at 9c56fd8 antlr: match Homebrew style guide
192-168-1-29:local victorhooi$ brew update
From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
Error: No such file or directory - /usr/local/Cellar
192-168-1-29:local victorhooi$

Not sure why exactly this is happening?

Hmm, this issue seems to have been going on for a while...lol. Is there a definitive fix for it?

Cheers,
Victor

Contributor

victorhooi commented Jun 14, 2011

heya,

Hmm, I'm encoutering this issue as well:

192-168-1-29:local victorhooi$ brew update

Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 38403, done.
remote: Compressing objects: 100% (17202/17202), done.
remote: Total 38403 (delta 22941), reused 34248 (delta 20619)
Receiving objects: 100% (38403/38403), 5.30 MiB | 450 KiB/s, done.
Resolving deltas: 100% (22941/22941), 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

I then tried mecca831's instructions from above, and got an error about /usr/local/Cellar:

192-168-1-29:local victorhooi$ cd /usr/local && git reset --hard HEAD
HEAD is now at 9c56fd8 antlr: match Homebrew style guide
192-168-1-29:local victorhooi$ brew update
From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
Error: No such file or directory - /usr/local/Cellar
192-168-1-29:local victorhooi$

Not sure why exactly this is happening?

Hmm, this issue seems to have been going on for a while...lol. Is there a definitive fix for it?

Cheers,
Victor

@soupmatt

This comment has been minimized.

Show comment Hide comment
@soupmatt

soupmatt Jun 14, 2011

Contributor

Try the fix here: mxcl#5128 (comment)

Contributor

soupmatt commented Jun 14, 2011

Try the fix here: mxcl#5128 (comment)

@mxcl

This comment has been minimized.

Show comment Hide comment
@mxcl

mxcl Jun 15, 2011

Member

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.

Member

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 in 8bec9b1 Jun 15, 2011

@mxcl

This comment has been minimized.

Show comment Hide comment
@mxcl

mxcl Jun 15, 2011

Member

Those still suffering can:

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

mxcl commented Jun 15, 2011

Those still suffering can:

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

This comment has been minimized.

Show comment Hide comment
@dtan

dtan 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

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

This comment has been minimized.

Show comment Hide comment
@cschep

cschep Aug 3, 2011

Contributor

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?

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

This comment has been minimized.

Show comment Hide comment
@dylanvee

dylanvee Aug 3, 2011

Contributor

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

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

This comment has been minimized.

Show comment Hide comment
@cschep

cschep Aug 3, 2011

Contributor

@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.

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

This comment has been minimized.

Show comment Hide comment
@mxcl

mxcl Aug 3, 2011

Member

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

Member

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

This comment has been minimized.

Show comment Hide comment
@idev

idev 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.

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

This comment has been minimized.

Show comment Hide comment
@dylanvee

dylanvee Aug 8, 2011

Contributor

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

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

Fix first `brew update` with Git 1.7.4+; Fixes #5128
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 #6017.

etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 27, 2011

Fix first `brew update` with Git 1.7.4+; Fixes #5128
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 #6017.
@conatus

This comment has been minimized.

Show comment Hide comment
@conatus

conatus 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.

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

This comment has been minimized.

Show comment Hide comment
@martyvona

martyvona Mar 29, 2012

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

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
@benhoxie

This comment has been minimized.

Show comment Hide comment
@benhoxie

benhoxie 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

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

@stonegao

This comment has been minimized.

Show comment Hide comment
@stonegao

stonegao Aug 21, 2012

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

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

This comment has been minimized.

Show comment Hide comment
@jasonbosco

jasonbosco Aug 24, 2012

@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)

@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

This comment has been minimized.

Show comment Hide comment
@mcandre

mcandre Oct 1, 2012

@jasonbosco Thanks! Works for me!

Specs:

  • Homebrew
  • Mac OS X 10.8.2
  • MacBook Pro 2009

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

Fix first `brew update` with Git 1.7.4+; Fixes #5128
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 #6017.
@snez

This comment has been minimized.

Show comment Hide comment
@snez

snez Aug 29, 2013

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

snez commented Aug 29, 2013

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

@ShujiaHuang

This comment has been minimized.

Show comment Hide comment
@ShujiaHuang

ShujiaHuang Dec 17, 2013

Thanks @snez your suggestion is work!

Thanks @snez your suggestion is work!

@ciaranarcher

This comment has been minimized.

Show comment Hide comment
@ciaranarcher

ciaranarcher Dec 29, 2013

+1 @snez

@scottspeidel

This comment has been minimized.

Show comment Hide comment
@scottspeidel

scottspeidel Aug 29, 2014

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

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

@jacknagel jacknagel 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.