Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing Github behind corporate proxy Node.js

I am having an issue with calling the following command from cmd for installing PhoneGap:

npm install -g phonegap

The following error is returned:

Failed to connect to github.com port 443: Timed out

There are a fair amount of questions regarding this topic and they all seem to provide the same answer - make sure the proxy settings for git and nodejs are configured. I set up the node proxy settings like so:

npm config set proxy http://proxyname:8080
npm config set https-proxy http://proxyname:8080

And for git:

git config --global http.proxy http://proxyname:8080
git config --global https.proxy http://proxyname:8080

Both git config --list and npm config list confirm that these proxy settings are in place.

I have also allowed the programs through the fire wall by going to Windows Firewall -> Allow a program or feature through windows firewall. Then I selected the node.exe for Node.js and for git I selected git.exe.

I still however have the issue whereby it is failing to connect to Github. Is there anything else I am missing or forgetting to setup? Both Node.js and Git were installed for the first time for this task.

like image 837
Reece Kenney Avatar asked Jan 09 '23 01:01

Reece Kenney


1 Answers

In addition to the above settings, it's possible that you're getting this error if some of the downloaded libraries declare their dependencies using the git:// protocol instead of https://. These dependencies then usually fail with the above error.

To fix this, you can run the following:

git config --global url."https://".insteadOf git://

This will add a configuration option to Git, asking Git to use https whenever a URL uses the git:// protocol.

This setting fixed many proxy issues for me.

like image 174
nwinkler Avatar answered Jan 17 '23 03:01

nwinkler