brew: brew update returns 403 Forbidden while accessing
I haven’t used brew and brew update since a while, I installed it along this HowTo
brew doctor shows only warnings, no errors.
sudo chown -R $(whoami) $(brew --prefix) doesn’t show errors, all permissions of owner is set to user
Bug reports:
When I try to update brew (I tried many times) I get the error:
$ brew update
warning: Option "depth" is ignored for https://github.com/Homebrew/brew.git
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/Homebrew/brew.git/info/refs
fatal: HTTP request failed
brew version is:
$ brew --version
Homebrew 0.9.8 (git revision dde20; last commit 2016-06-04)
Homebrew/homebrew-core (git revision d6ae; last commit 2016-06-07)
I have a MacBook Pro (Mid 2009) with OS 10.11.5 I read the Troubleshooting list without success. I read issue #11221 of brew legacy, but think that is not related. XCode 7.3.1 is uptodate (including CLT). What can be wrong? Thank, frank
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (10 by maintainers)
Where does this custom Git installation come from? That’s not the system Git and also not installed via Homebrew. Additionally, it is a bit outdated. Can you please try removing it from your
PATHsuch thatwhich gitoutputs/usr/bin/gitandgit --versionoutputsgit version 2.7.4 (Apple Git-66)?You might need to run
hash -rif your shell prints an error message that is something like “No such file or directory” or continues to invoke the old Git even after you changed thePATH.@UniqMartin sounds like we should follow that logic but also check the version to ensure that we only use a Git that’s got a high enough version to e.g. handle GitHub’s HTTPS.
Thanks for your input @dougreese and thank you for following up on my mail!
The lookup logic is actually quite complicated and does a lot more than just looking in
PATH:HOMEBREW_GITis set in the environment, try that.GITis set in the environment, try that.gitformula is installed, try that.gitbinaries inPATH, but exclude/usr/bin/gitbecause it might be a non-functional popup stub if neither Xcode nor Command Line Tools are installed.gitbinary usingxcrun -find git.gitfrom Xcode if it is installed in/Applications/Xcode.app./usr/bin/gitif all else failed and we’re sure it’s not a popup stub.The first item from that list that matches wins. Now that I’ve written down the logic, I’m no longer sure this is what should be happening. You might just have helped uncover a bug (or misfeature) in our code. I’ll ponder this a bit and check whether we want to improve on that. (In any case, this rundown should help understand why it was picking the “wrong” Git on your machine, probably in step 4.)
This is a good suggestion; I agree! Homebrew relies quite a bit on a working Git installation, thus including things like its version and installation path would be valuable information in
brew config.And: What is the output of
which gitandgit --version? Are you using the systemgiton or did you install it via Homebrew? If the latter, could you temporarily unlink it viabrew unlink git, check thatgit --versionreturns something likegit version 2.7.4 (Apple Git-66), and then trybrew updateagain?To be honest, I’m also running out of ideas right now. Can you give it one more try, but this time with the
--debugflag, i.e.brew update --debug --verboseand post the output? Hopefully this provides a bit more information and helps me understand where it’s actually failing and why …Alright, first to fix the errors relating to
/usr/local/share/man/man1/brew-cask.1:Back to the update issue, I’m not sure yet what is going on. Are you using a proxy that might be causing this issue? What is the output of
env | grep -i proxy?Please also try one more time with
brew update --verboseand post the output of this command.You have quite a few warnings in your
brew doctoroutput, but nothing that would explain the trouble. Your Git configuration also looks fine and manually fetching withgit fetch originseems to work. I suppose you haven’t made any customizations to Homebrew itself, thus please try the following:If this doesn’t print an error, run
brew --versionfirst (it should be printing “Homebrew 0.9.9”) and then givebrew updateone more try. I’m somewhat hopeful it will work this time.Unrelated to the problem at hand, but if you can, try to fix some of the warnings printed by
brew doctor. E.g. the complaint about a duplicatebrew-caskis because Homebrew Cask no longer needs to be installed as a formula. You can runbrew remove brew-caskandbrew caskwill continue to work as usual.Can you please post the output of
brew doctor? All it outputs is just warnings, but one of them might be responsible for the behavior you are seeing.Can you please post the contents of
/usr/local/.git/configand your own.gitconfigin your home directory? (Make sure the latter doesn’t contain sensitive information you don’t want to post publicly.) The update issue sounds like some Git configuration problem, so seeing those files would be really helpful.What happens if you do the following? (Please also post the output of these commands.)
This looks really suspicious. Something went wrong with the migration to the new Homebrew repository and you’re stuck with Homebrew 0.9.8. It should be showing “Homebrew 0.9.9”, but the problem is probably related to the update issue (that might be related to a Git configuration problem).