Skip to content

Instantly share code, notes, and snippets.

@KevinTCoughlin
Last active January 26, 2019 13:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KevinTCoughlin/9688528 to your computer and use it in GitHub Desktop.
Save KevinTCoughlin/9688528 to your computer and use it in GitHub Desktop.
Simple bash script to set/unset my common proxy settings.
#!/bin/bash
set -o nounset
set -o errexit
HOST="example.com"
PORT=8080
if [ $1 == "on" ]; then
eval `export http_proxy=http://$HOST:$PORT`
eval `npm config set proxy http://$HOST:$PORT`
eval `git config --global http.proxy http://$HOST:$PORT`
echo Proxy Set
else
eval `unset http_proxy`
eval `npm config delete proxy`
eval `git config --global --unset core.gitproxy`
echo Proxy Unset
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment