Skip to content

Instantly share code, notes, and snippets.

@pom421
Created October 17, 2017 17:40
Show Gist options
  • Save pom421/d5d342e9fe47b5a7ce8395251dfc9ed5 to your computer and use it in GitHub Desktop.
Save pom421/d5d342e9fe47b5a7ce8395251dfc9ed5 to your computer and use it in GitHub Desktop.
Set/unset proxy
# Set Proxy
function setproxy() {
export PROXY=http://10.10.10.10:8080
export {http,https,ftp}_proxy=$PROXY
export {HTTP,HTTPS,FTP}_PROXY=$PROXY
# git
git config --global http.proxy $PROXY
git config --global https.proxy $PROXY
# npm
npm config set proxy $PROXY
}
# Unset Proxy
function unsetproxy() {
unset {http,https,ftp}_proxy
unset {HTTP,HTTPS,FTP}_PROXY
unset {ALL,_}PROXY
# git
git config --global --unset http.proxy
git config --global --unset https.proxy
# npm
npm config delete proxy
}
function showproxy() {
echo "Affichage des paramètres proxy du poste de développement"
echo "--------------------------------------------------------"
env | grep PROXY | grep -v ALL_PROXY
env | grep ALL_PROXY
env | grep http_proxy
env | grep https_proxy
echo "git http.proxy :" $(git config --global --get http.proxy)
echo "git https.proxy :" $(git config --global --get https.proxy)
echo "npm proxy :" $(npm config get proxy)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment