windows环境下设置命令行CMD、Git、NPM和Bower代理设置

在公司的电脑只能通过设置代理访问外网时,需要设置代理

 

命令行CMD代理设置

代理不需要密码时,在命令行界面输入:

set http_proxy=http://proxy_ip_or_fqdn:8080

代理需要用户密码时,在命令行界面输入:

set http_proxy=http://proxy_user:proxy_password@proxy_ip_or_fqdn:8080

Git代理设置

类似,git设置代理如下:

git config --global http.proxy http://proxy_ip_or_fqdn:8080

git config --global http.proxy http://proxy_user:proxy_password@proxy_ip_or_fqdn:8080

设置完成后,可以通过如下命令来查看设置是否生效:
git config --get --global http.proxy

删除代理设置,使用:
git config --global --unset http.proxy

 

NPM代理设置

npm设置代理方法如下:

npm config set proxy=http://proxy_ip_or_fqdn:8080

npm config set proxy=http://proxy_user:proxy_password@proxy_ip_or_fqdn:8080


Bower代理设置

编辑.bowerrc文件

{
  "proxy": "http://proxy_ip_or_fqdn:8080",
  "https-proxy": "http://proxy_ip_or_fqdn:8080"
}


你可能感兴趣的:(代理设置)