Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does git fetch fail with "Could not resolve host: (nil)..." with https://github.com/mxcl/homebrew origin?

Tags:

git

github

https

I was unable to install Homebrew (see my question on apple.stackexchange.com), so I looked at the https://raw.github.com/mxcl/homebrew/go Ruby script and tried the same commands it runs:

$ git init -q
$ git remote add origin https://github.com/mxcl/homebrew
$ git fetch origin master:refs/remotes/origin/master -n
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

Why am I getting this error?

Update: (in response to madhead's answer)

I get the same problem when I use the URL with .git postfixed:

$ git init -q
$ git remote add origin https://github.com/mxcl/homebrew.git
$ git fetch origin master:refs/remotes/origin/master -n
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

Update #2:

I don't think this was a proxy issue (as suggested in neil's answer).

I tried this again and it worked!

$ git init -q
$ git remote add origin https://github.com/mxcl/homebrew
$ git fetch origin master:refs/remotes/origin/master -n
remote: Counting objects: 126721, done.
remote: Compressing objects: 100% (59085/59085), done.
remote: Total 126721 (delta 89963), reused 100145 (delta 66623)
Receiving objects: 100% (126721/126721), 19.68 MiB | 702 KiB/s, done.
Resolving deltas: 100% (89963/89963), done.
From https://github.com/mxcl/homebrew
 * [new branch]      master     -> origin/master

I looked in my ~/.gitconfig file and discovered I had already defined a proxy. I think that was already there when I had the problem, but to confirm I removed it and got a different error:

$ git fetch origin master:refs/remotes/origin/master -n
error: Failed connect to github.com:443; Connection refused while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack
fatal: HTTP request failed

My theory is that github or homebrew had some kind of problem that they've since fixed.

like image 724
Daryl Spitzer Avatar asked Feb 15 '23 13:02

Daryl Spitzer


1 Answers

For those getting this error when NOT behind a proxy:

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

the solution may be to clear the git proxy settings:

$ git config --global --unset core.gitproxy
like image 65
user63497 Avatar answered Feb 18 '23 08:02

user63497