-
-
Save siliconmeadow/275d2b949e9d27eec0b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ -z "$1" ]]; then | |
echo "Usage: proxy_switch.sh en 1.1.1.1:8080. | |
proxy_switch.sh dis" | |
exit 2; | |
fi | |
if [[ "$1" == "en" ]]; then | |
export http_proxy=http://$2 | |
export https_proxy=http://$2 | |
export HTTP_PROXY=https://$2 | |
export HTTPS_PROXY=https://$2 | |
git config --global http.proxy $2 | |
npm config set proxy http://$2 | |
npm config set https-proxy https://$2 | |
elif [[ "$1" == "dis" ]]; then | |
export http_proxy= | |
export https_proxy= | |
export HTTP_PROXY= | |
export HTTPS_PROXY= | |
git config --global http.proxy "" | |
npm config delete proxy | |
npm config delete https-proxy | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment