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

brew update doesn't work #10292

Closed
sberghel opened this issue Feb 18, 2012 · 13 comments
Closed

brew update doesn't work #10292

sberghel opened this issue Feb 18, 2012 · 13 comments

Comments

@sberghel
Copy link

When I try to run a brew update, the following happens:

sberghel:~ skye$ brew update
remote: Counting objects: 77, done.
remote: Compressing objects: 100% (28/28), done.
error: insufficient permission for adding an object to repository database .git/objects

fatal: failed to write object
fatal: unpack-objects failed

Error: Failed while executing git pull origin refs/heads/master:refs/remotes/origin/master

@mxcl
Copy link
Contributor

mxcl commented Feb 18, 2012

Sounds like you need to fix the permissions on your .git directory.

chown -R $(whoami) /usr/local.git should do it.

@2bits
Copy link
Contributor

2bits commented Feb 18, 2012

ls -ld $HOMEBREW_PREFIX
ls -la $HOMEBREW_PREFIX
brew --config
brew doctor

@sberghel
Copy link
Author

Changing my permissions did the trick, thanks.

@mattcg
Copy link
Contributor

mattcg commented Dec 11, 2012

There's a missing slash in @mxcl's command above. It's actually

chown -R $(whoami) /usr/local/.git

@mralexgray
Copy link

i had to do cd /usr/local/Library && git stash && git clean -f

@EricAllsop
Copy link

Thanks mralexgray the stash and clean worked for me.

@moontan
Copy link

moontan commented Apr 8, 2013

Hi, I also get Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master when trying brew update but none of the above solutions work for me. I haven't updated in two or three months.

@moontan
Copy link

moontan commented Apr 8, 2013

Oh, I just noticed there's another error before that:
The following untracked working tree files would be overwritten by merge: (…) Please move or remove them before you can merge.
Perhaps I should just follow these instructions.

@ofloveandhate
Copy link

i WAS getting:

error: Your local changes to the following files would be overwritten by merge: Library/Formula/vtk.rb 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

but mralexgray helped out. the ol' copypasta into terminal, and bam, brewing again:
cd /usr/local/Library && git stash && git clean -f

@richardjortega
Copy link

Thanks @mralexgray the stash and clean worked for me as well.

@fgarcia
Copy link

fgarcia commented Nov 26, 2013

In my case I had the same problem and @mralexgray did not work for me. I even nuked the whole thing:

rm -rf /usr/local/.git
brew update

That did not solve the problem either. I had to:

sudo brew update

And now it is working again, so far no "root" owned files within the .git repo

@MikeMcQuaid
Copy link
Member

Do sudo chown -R $USER /usr/local. Don't run brew commands with sudo.

@fgarcia
Copy link

fgarcia commented Nov 26, 2013

I already did that, and I know that we should not mix "sudo" and "brew" together. Even so, the "sudo brew update" was the only thing that worked.

However immediately afterwards I did chown to my user the whole tree, just to make sure everything stays under my user access. Hopefully that might help someone else, but still... it was such an odd solution

@Homebrew Homebrew locked and limited conversation to collaborators Apr 18, 2015
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