1

I'm trying to install Homebrew on OS X 10.8.4, and get the following:

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> Downloading and Installing Homebrew...
error: Could not resolve host: (nil); nodename nor servname provided, or not known while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack
fatal: HTTP request failed
Failed during: git fetch origin master:refs/remotes/origin/master -n

What is causing this problem? How do I work around it?

Update (with answers to the questions in sameetandpotatoes's comment):

$ curl -Lsf http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
bin/: Can't update time for bin
share/: Can't update time for share
share/man/: Can't update time for share/man
share/man/man1/: Can't update time for share/man/man1
tar: Error exit delayed from previous errors.

$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

I haven't installed Xcode. But I did install "Command Line Tools (OS X Mountain Lion) for Xcode - April 2013" from https://developer.apple.com/downloads/index.action.

Update #2:

$ git --version
git version 1.7.12.4 (Apple Git-37)
$ which git
/usr/bin/git

So it appears I don't have the same problem as in this answer (referred to in sameetandpotatoes's second comment below).

Update #3:

I discovered the above install must have (at least partially) installed brew, as it was in my /usr/local/bin/. Running brew brought up the help. But I got the following:

$ brew update
Initialized empty Git repository in /usr/local/bin/homebrew/.git/
error: Could not resolve host: (nil); nodename nor servname provided, or not known while accessing https://github.com/mxcl/homebrew.git/info/refs?service=git-upload-pack
fatal: HTTP request failed
Error: Failure while executing: git fetch origin

I then tried re-installing using the instructions in this answer:

$ pwd
/usr/local/bin
$ mkdir homebrew
$ curl -L https://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   128  100   128    0     0    191      0 --:--:-- --:--:-- --:--:--   352
100  938k  100  938k    0     0   256k      0  0:00:03  0:00:03 --:--:--  334k
$ rm brew
$ ln -s homebrew/bin/brew /usr/local/bin/brew

But I get almost the exact same error when I try brew update:

$ brew update
Initialized empty Git repository in /usr/local/bin/homebrew/.git/
error: Could not resolve host: (nil); nodename nor servname provided, or not known while accessing https://github.com/mxcl/homebrew.git/info/refs?service=git-upload-pack
fatal: HTTP request failed
Error: Failure while executing: git fetch origin

Could this be a problem with my installation or configuration of git? (I use it without a problem with other remote repositories.) Or could it be a (temporary?) problem with github.com?

Update #4: (in response to IOXenus's answer)

I didn't want to keep Homebrew installed anywhere other than the standard /usr/local/, so I deleted all traces of Homebrew (including /usr/local/.git/).

Then I ran the following:

$ git init -q
$ git remote set-url origin git://github.com/mxcl/homebrew
fatal: No such remote 'origin'
$ git remote add origin git://github.com/mxcl/homebrew
$ git fetch origin master:refs/remotes/origin/master -n
remote: Counting objects: 124335, done.
remote: Compressing objects: 100% (61076/61076), done.
remote: Total 124335 (delta 87425), reused 96557 (delta 62265)
Receiving objects: 100% (124335/124335), 19.56 MiB | 698 KiB/s, done.
Resolving deltas: 100% (87425/87425), done.
From git://github.com/mxcl/homebrew
 * [new branch]      master     -> origin/master
$ git reset --hard origin/master
HEAD is now at 2a3fc63 tractorgen 0.31.7

And I was able to successfully run brew doctor and brew update.

3

2 Answers 2

2
+50

Seems that you have problems connecting to github via https.

While I'm not sure what could cause it and how to fix it, you still can use git with another protocol.

Here's the commands to install homebrew in /usr/local/ from scratch using git:// instead of https://:

cd /usr/local/
git init -q
git remote add origin git://github.com/mxcl/homebrew
git fetch origin master:refs/remotes/origin/master -n
git reset --hard origin/master

That should work. Please notice that if you choose to use another directory for homebrew, you probably will have to append its ./bin directory to your environment PATH variable for comfortable usage.

2
  • If you edit your answer so it works if brew is not already installed (use git remote add instead of git remote set-url) I'll accept your answer and you'll get your bounty. Aug 17, 2013 at 16:16
  • @DarylSpitzer sure, done. Aug 18, 2013 at 18:25
2

The error with git clone over http is related to your git configuration I had the same issue and once I removed the git config [ http.proxy config ] I was home free ...

The configuration by the way was propagated from my corporate network so when I was hacking off at home I found this issue.

I used

git config -l | grep proxy

then

git config --global --unset-all http.proxy

And after the installation all you need to do is

git config --global http.proxy $http_proxy

That's it, please remember you will have to do this every time you are not using this proxy ... I would probably have a setproxy / noproxy function in profile for this ...

1
  • 1
    This works for homebrew too, and you need to do git config --unset-all http.proxy
    – user34302
    Nov 26, 2015 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .