Reputation: 269
Am getting the following error while trying to pull/push or create new-clone
error: couldn't connect to host while accessing https://github.com/user/pack.git/info/refs fatal: HTTP request failed
when i googled, people suggested to setup http_proxy.. but i don't understand it or i don't know to setup it.. am totally stuck up with it..
i don't know how to overcome these issues..
any help would be appreciated..
NB: note that i was able to use git before couple of days.. in the last couple of days it has been screwed up.. please help..
Upvotes: 26
Views: 54857
Reputation: 2016
I have experienced the same error when wanted to push code on github. The problem was that I had messed up some environment variables on my Ubuntu machine. This happened because I wanted to use a manual proxy on google chrome.
If you are using linux use the following command to see if http_proxy
and https_proxy
are set to some ip address.
env | grep http_proxy
Then use the following commands to unset
the value of these two variables.
unset http_proxy
unset https_proxy
Try to use git again. If it does not work then do a reboot. It worked for me.
Upvotes: 2
Reputation: 639
git config --global --unset http.proxy
git config --global --unset https.proxy
works for me
Upvotes: 17
Reputation: 5116
I got same error when try to pull using different linux user.
ls -lah
whoami
Make sure current user is same as owner of that folder.
Upvotes: 0
Reputation: 102398
I was getting a similar error in Visual Studio 2013:
An error occurred. Detailed message: An error was raised by libgit2. Category = Net (Error).
An error occurred while sending the request.
Then I tried using Git GUI:
Pushing to https://[email protected]/myrepo/bhp.git
error: Couldn't resolve host 'bitbucket.org' while accessing https://[email protected]/myrepo/bhp.git/info/refs?service=git-receive-pack
fatal: HTTP request failed
Guess what... my Parallels Virtual Machine
had no internet connection at the moment. After reestablishing the internet connection I could push my commit. :) Can't believe that happened. We're so used to have an internet connection always on.
Upvotes: 0
Reputation: 5540
I gave the follwoing command to restart my network services. This would work for sure:
service network restart
Upvotes: 3
Reputation: 609
My extremely simple solution was to first clone the empty new repo. I then deleted the .git folder in my project and moved all my project files & folders into the new repo folder. I then changed directories into that folder and then ran the add
, commit
, and push
commands. Everything worked well.
Before trying this solution, I had not cloned the git repo first. My project folder and the repo had the same name, I had run git init
, add
, commit
, and set the upstream, but push
was giving me an error (failure to connect to host).
Upvotes: 0
Reputation: 10425
I've faced the same error when I changed the network that my laptop was connected. Editing /etc/resolv.conf properly solved the problem:
nameserver 8.8.8.8
Making resolv.conf blank and reboot might solve it too.
On debian 2.6.32-5-amd64 + VirtualBox 4.2.12.
Upvotes: 6
Reputation: 13572
This happened to me on my Vagrant VirtualBox VM running Ubuntu 12.04. The vagrant instance had been up for several days. I restarted the VM (vagrant reload
), ssh'd back in, and it worked.
What's the cause? Not sure. Someone else can speculate. However, I always like to reboot three times just to be sure ;)
Upvotes: 7
Reputation: 44234
One solution, if this is a repository under you control, would be to use an SSH key for your repository access instead of HTTP. Update your remote accordingly by dropping the origin
remote with:
git remote rm origin
git remote add origin <ssh_path_from_github>
You can find the ssh path in github here:
Make sure to preface it with ssh://
when you re-add the remote. If this doesn't work then we'll look at the http proxy settings, but based on your faux github link, I'm hoping it's a repository under your control.
Upvotes: 2