Created
July 24, 2018 12:56
-
-
Save 0gust1/2fabb03a78139f2b2f9c05b897065803 to your computer and use it in GitHub Desktop.
Working behind a corporate proxy - snippet to copy/paste in your shell rc file (or profile)
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
setProxy(){ | |
export all_proxy=socks://url.to.proxy:80 | |
export http_proxy=http://url.to.proxy:80 | |
export https_proxy=$http_proxy | |
export ftp_proxy=$http_proxy | |
export ALL_PROXY=$all_proxy | |
export HTTP_PROXY=$http_proxy | |
export HTTPS_PROXY=$http_proxy | |
export FTP_PROXY=$http_proxy | |
export no_proxy="localhost, 127.0.0.1, .internal.domain" | |
export NO_PROXY=$no_proxy | |
} | |
unsetProxy(){ | |
PROXY_ENV=( \ | |
"http_proxy" "ftp_proxy" "https_proxy" "all_proxy" \ | |
"HTTP_PROXY" "HTTPS_PROXY" "FTP_PROXY" "ALL_PROXY" \ | |
"NO_PROXY"\ | |
) | |
for envar in ${PROXY_ENV[@]} | |
do | |
unset $envar | |
done | |
} | |
setProxy #by default, set the proxy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
*.rc
file or your profile.unsetProxy
in your shell.TIPS :
The location of this file (shell rc file) depends of your system (Win/*Nix) and your command line environment.
Windows :
With git bash / Cmder :
C:\Users\YOUR_USER\.bashrc
(create it, if it doesn't exist)With babun (http://babun.github.io/) :
C:\Users\YOUR_USER\.babun\cygwin\home\USERNAME\.babunrc
OSX/Linux :
~/.bashrc
(or~/.zshrc
, etc. depending on your choice of shell)