cmd、npm和git代理设置与清除

1、cmd代理设置
打开 cmd (win + R,输入 cmd,然后按 enter 键),然后输入如下命令:

set http_proxy=http://proxy.yourname.com:8080

其中 http://proxy.yourname.com 是你的代理服务器地址,而 8080 是端口号。如果你的代理服务器要求用户名和密码的话,还需要:

set http_proxy_user=
set http_proxy_pass=

设置完成后,就可以在 cmd 下正常使用网络了。

2、cmd代理清除
eg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyEnable /t REG_DWORD /d 0 /f

3、npm代理设置
npm config set proxy=http://proxy.yourname.com:8080

4、npm代理清除
npm config delete proxy

5、git代理设置
git config --global http.proxy http://proxy.yourname.com:8080

如果需要用户名密码,则设置:

git config –global http.proxy http://user:password@http://proxy.yourname.com:8080

其中 user 和 password 分别为你的用户名和密码。
设置完成后,可以通过如下命令来查看设置是否生效:

git config –get –global http.proxy

6、git代理清除
git config --system (或 --global 或 --local) --unset http.proxy

猜你喜欢

转载自blog.csdn.net/qq_41454044/article/details/102513814
今日推荐