Last active
March 23, 2024 15:24
-
-
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`
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
| 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