git&npm设置proxy

Npm 设置 proxy

1
2
3
4
5
6
npm config set proxy http://127.0.0.1:1087
npm config set https-proxy http://127.0.0.1:1087

# 需要认证的 proxy
npm config set proxy http://username:password@server:port
npm config set https-proxy http://username:pawword@server:port

Npm 取消 proxy

1
2
npm config rm proxy
npm config rm https-proxy

Git 设置给特定url设置 proxy

1
2
3
4
5
6
git config --global http.proxy http://127.0.0.1:1087
git config --global https.proxy https://127.0.0.1:1087

# 只对github.com
git config --global http.https://github.com.proxy http://127.0.0.1:1087
git config --global https.https://github.com.proxy https://127.0.0.1:1087

Git 取消 proxy

1
2
git config --global --unset http.https://github.com.proxy
git config --global --unset https.https://github.com.proxy