Skip to content

Instantly share code, notes, and snippets.

@xpol
Created January 8, 2016 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpol/f43c5e7aaeadb78b26d9 to your computer and use it in GitHub Desktop.
Save xpol/f43c5e7aaeadb78b26d9 to your computer and use it in GitHub Desktop.
function proxy {
case $1 in
[1-9]*)
export http_proxy=socks5://127.0.0.1:$1
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
;;
off)
unset http_proxy
unset https_proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
;;
la|lantern)
export http_proxy=http://127.0.0.1:8787
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
;;
ss|shadowsocks)
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
;;
pr|privoxy)
export http_proxy=http://127.0.0.1:8118
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
;;
"")
echo usage: proxy [port\|ss\|shadowsocks\|la\|lantern\|off]
;;
esac
echo http_proxy=$http_proxy
echo https_proxy=$https_proxy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment