Skip to content

Instantly share code, notes, and snippets.

@TechQuery
Last active March 23, 2024 15:24
Show Gist options
  • Select an option

  • Save TechQuery/fc18a5890a3b9a5b626039bd6ad8fd96 to your computer and use it in GitHub Desktop.

Select an option

Save TechQuery/fc18a5890a3b9a5b626039bd6ad8fd96 to your computer and use it in GitHub Desktop.
Execute this script in Administrator's Terminal, or use with `sudo` Command, for example: `sudo set-proxy.ps1 12345`
param(
[Int] $port
)
$URL = "http://127.0.0.1:$port"
[environment]::SetEnvironmentVariable('HTTP_PROXY', $URL, "Machine")
[environment]::SetEnvironmentVariable('HTTPS_PROXY', $URL, "Machine")
git config --global http.proxy $URL
git config --global https.proxy $URL
npm config --global set proxy=$URL
npm config --global set https-proxy=$URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment