Skip to content

Instantly share code, notes, and snippets.

@tkhoa2711
Last active March 14, 2016 06:00
Show Gist options
  • Save tkhoa2711/963adc1a687476a7eb01 to your computer and use it in GitHub Desktop.
Save tkhoa2711/963adc1a687476a7eb01 to your computer and use it in GitHub Desktop.
Update http(s) proxy settings for git
# read in username and password for system http(s) proxy settings
read -s -p "Username: " USERNAME; echo ''
read -s -p "Password: " PASSWORD; echo ''
read -s -p "HTTP(S) Proxy (host:port): " HTTP_PROXY_HOST_PORT; echo ''
export {http_proxy,https_proxy}="http://$USERNAME:$PASSWORD@$HTTP_PROXY_HOST_PORT"
# update http(s) proxy settings for git
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
git config --global http.sslVerify false
git config --global https.sslVerify false
# you may want to limit access to this config from now on
chmod 600 ~/.gitconfig
# and probably unset the env variables
unset USERNAME PASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment