- 判断是否生效
- http
- socks
- 使用sock5 set http_proxy=socks5://127.0.0.1:10808 set https_proxy=socks5://127.0.0.1:10808
- 取消
- git单独设置
npm- http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890">http代理
npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890
yarn- http://127.0.0.1:7890
yarn config set https-proxy http://127.0.0.1:7890">http代理
yarn config set proxy http://127.0.0.1:7890
yarn config set https-proxy http://127.0.0.1:7890 - PowerShell
判断是否生效
http
- linux:
export http_proxy=http://127.0.0.1:1087; export https_proxy=http://127.0.0.1:1087;
- window:
set http_proxy=http://127.0.0.1:1087; set https_proxy=http://127.0.0.1:1087;
socks
- linux:
export http_proxy=socks5://127.0.0.1:10808 export https_proxy=socks5://127.0.0.1:10808
- window:
使用sock5 set http_proxy=socks5://127.0.0.1:10808 set https_proxy=socks5://127.0.0.1:10808
取消
- linux:
unset http_proxy unset https_proxy
- window:
set http_proxy= set https_proxy=
git单独设置
git config —global http.proxy ‘socks5://127.0.0.1:10808’ git config —global https.proxy ‘socks5://127.0.0.1:10808’ # 取消 git config —global —unset http.proxy git config —global —unset https.proxy
npm
设置代理
http代理
npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890
取消代理
npm config delete proxy
npm config delete https-proxy
yarn
设置代理
http代理
yarn config set proxy http://127.0.0.1:7890
yarn config set https-proxy http://127.0.0.1:7890
取消代理
yarn config delete proxy
yarn config delete https-proxy
PowerShell
$Env:http_proxy=”http://127.0.0.1:7890“;
$Env:https_proxy=”http://127.0.0.1:7890“;
上方列出的关于终端的代理大多都是临时命令,重启终端就会失效,如果想要永久设置代理,可以使用使用自定义配置
在 PowerShell 窗口中运行如下指令:
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
默认会使用记事本打开一个文件,在文件中加入上面设置代理的命令,保存关闭即可。
