标签:
Sources: http://digitaldrummerj.me/proxy-configurations/
When you are using npm, bower, and git behind a proxy server you have to do a little bit of configuration. Luckily it is super easy to do these configurations. Almost all of the programs have command line commands to set and unset the proxy server.
set http_proxy=[Your Proxy]:[Proxy Port]
set https_proxy=[Your Proxy]:[Proxy Port]
set http_proxy=
set https_proxy=
Run from an administrative command prompt
setx http_proxy=[Your Proxy]:[Proxy Port] /M
setx https_proxy=[Your Proxy]:[Proxy Port] /M
You will need to close and re-open command prompt for settings to take effect
Run from a non-administrative command prompt
setx http_proxy=[Your Proxy]:[Proxy Port]
setx https_proxy=[Your Proxy]:[Proxy Port]
You will need to close and re-open command prompt for settings to take effect
Run from an administrative command prompt
setx http_proxy="" /M
setx https_proxy="" /M
Need to close and re-open command prompt for settings to take effect
Run from a non-administrative command prompt
setx http_proxy=""
setx https_proxy=""
Need to close and re-open command prompt for settings to take effect
If the commands below just echo out the text instead of the actual proxy server, it means that the proxy server is not set.
echo %http_proxy%
echo %https_proxy%
File Name: .bash_profile or .bashrc
export http_proxy=[Your Proxy]:[Proxy Port]
export https_proxy=[Your Proxy]:[Proxy Port]
export npm_config_proxy=[Your Proxy]:[Proxy Port]
export npm_config_https_proxy=[Your Proxy]:[Proxy Port]
Note: After updated the .bash_profile or .bashrc, you should run one of the following commands to make the configuration active for the current session.
source ~/.bashrc
or
source ~/.bash_profile
There is no command line that I found for configuring bower. Instead you need to create a .bowerrc file in the users home directory.
On Windows: %userprofile% directory.
On Linux: ~/
Windows Explorer unfortunately does not allow you to create files without extensions but using notepad you can create a file without an extension.
{
"proxy":"http://[Your Proxy]:[Proxy Port]",
"https-proxy":"http://[Your Proxy]:[Proxy Port]"
}
You can also set the proxy settings below to be system wide with the –system switch.
git config --add http.proxy http://[Your Proxy]:[Proxy Port]
git config --add https.proxy http://[Your Proxy]:[Proxy Port]
git config --unset http.proxy
git config --unset https.proxy
Just Proxy Configs
git config --get http.proxy
git config --get https.proxy
All Configs
git config --list
[http]
proxy = http://[Your Proxy]:[Proxy Port]
[https]
proxy = http://[Your Proxy]:[Proxy Port]
npm config set https-proxy http://[Your Proxy]:[Proxy Port]
npm config set proxy http://[Your Proxy]:[Proxy Port]
npm config delete https-proxy
npm config delete proxy
npm config get https-proxy
npm config get proxy
proxy=http://[Your Proxy]:[Proxy Port]
https-proxy=http://[Your Proxy]:[Proxy Port]
If you have set the proxy in the .bash_profile or .bashrc, then Ruby should pick it up.
If you need to manually set it
export http_proxy=[Your Proxy]:[Proxy Port] sudo gem install [your gem name]
setx http_proxy "[Your Proxy Server]:[Proxy Port]" /M
gem install [your gem name]
In order to run the ionic start command behind a proxy, you need start the command out with the Proxy information.
PROXY=http://[Your Proxy]:[Proxy Port] ionic start [App Name] [Template Name]
setx http_proxy "[Your Proxy Server]:[Proxy Port]" /M
ionic start [App Name] [Template Name]
The android SDK uses ~/.android/androidtool.cfg file to define the proxy information. If the file does not exist, go ahead and create it.
http.proxyHost=[Your Proxy]
http.proxyPort=[Proxy Port]
When trying to build an Android project that uses Gradle, you may need to configure the proxy for it.
On Windows: %userprofile%/.gradle.properties
systemProp.http.proxyHost=[Your Proxy]
systemProp.http.proxyPort=[Proxy Port]
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.proxyHost=[Your Https Proxy]
systemProp.https.proxyPort=[Https Proxy Port]
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
NPM, BOWER, GIT, AND BASH PROXY CONFIGURATIONS
标签:
原文地址:http://www.cnblogs.com/rosepotato/p/5871186.html