Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active August 29, 2015 14:01
Show Gist options
  • Save garystafford/9df7c9c2a8ffb76c1b71 to your computer and use it in GitHub Desktop.
Save garystafford/9df7c9c2a8ffb76c1b71 to your computer and use it in GitHub Desktop.
Prepare new environment with Git install, when machine is located behind a proxy server. Must run this .bat files 3x's due to nested variables.
# Run script 3 times because of the deeply nested variables
# PROXY_USERNAME is the username used to connect to proxy.
# May be different than the existing USERNAME.
# USERNAME is the account you logged into VM with,
# like 'Administrator', which may not have access through proxy
# Primary variables (CHANGE THESE FIRST!)
setx PROXY_HOSTNAME my_domain.com
setx PROXY_USERNAME my_user
setx PROXY_PASSWORD my_password
setx PROXY_SERVER my_server
setx PROXY_PORT my_port
# Secondary variables
setx HTTP_PROXY "http://%PROXY_USERNAME%:%PROXY_PASSWORD%@%PROXY_SERVER%.%PROXY_HOSTNAME%:%PROXY_PORT%"
setx HTTPS_PROXY %HTTP_PROXY%
setx FTP_PROXY %HTTP_PROXY%
setx ALL_PROXY %HTTP_PROXY%
setx NO_PROXY "localhost,127.0.0.1,*.%PROXY_HOSTNAME%,%USERDOMAIN%"
# Misc variables
setx GIT_CURL_VERBOSE 1
setx GIT_SSL_NO_VERIFY 1
# close and re-open the current command prompt to see changes
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment