-
-
Save 7aman/1b7f8dc857b5ae50395f0d9b4aca1d8e to your computer and use it in GitHub Desktop.
Revisions
-
m3y54m revised this gist
Dec 30, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -82,7 +82,7 @@ git config --global http.proxy socks5://127.0.0.1:10808 git config --global https.proxy socks5://127.0.0.1:10808 ``` ### Show ``` git config --get --global http.proxy @@ -91,7 +91,7 @@ git config --get --global http.proxy socks5 git config --get --global https.proxy socks5 ``` ### Unset ``` git config --global --unset http.proxy -
m3y54m revised this gist
Dec 30, 2022 . 1 changed file with 71 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,20 +2,22 @@ Assume that you want to set 127.0.0.1:10809 as HTTP proxy and 127.0.0.1:10808 as SOCKS proxy. [How to set a proxy for CMD/Powershell/Terminal/Git](https://theodorecooper.github.io/other/2022-cmd-proxy/) ## CMD / PowerShell Using `netsh` [Configure the proxy server manually using netsh command](https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/configure-proxy-internet?view=o365-worldwide#configure-the-proxy-server-manually-using-netsh-command) ### Tunnel all your internet traffic through a HTTP proxy ``` netsh winhttp set proxy 127.0.0.1:10809 bypass-list="localhost" ``` ### Tunnel all your internet traffic through a SOCKS proxy ``` netsh winhttp set proxy proxy-server="socks=127.0.0.1:10808" bypass-list="localhost" ``` ### View the current proxy settings: @@ -30,4 +32,70 @@ netsh winhttp show proxy netsh winhttp reset proxy ``` ## CMD / PowerShell Using Env. Variables ### Set ``` set http_proxy=http://127.0.0.1:10809 set https_proxy=http://127.0.0.1:10809 ``` ### Unset ``` set http_proxy= set https_proxy= ``` To delete variables for future cmd instances, do this: ``` setx http_proxy "" setx https_proxy "" ``` ## PowerShell Using Env. Variables ``` $env:HTTPS_PROXY="http://127.0.0.1:10809" $env:HTTP_PROXY="http://127.0.0.1:10809" $env:all_proxy="socks5://127.0.0.1:10808" ``` ## Bash ``` export https_proxy=http://127.0.0.1:10809 export http_proxy=http://127.0.0.1:10809 export all_proxy=socks5://127.0.0.1:10808 ``` ## Git ### Set ``` git config --global http.proxy http://127.0.0.1:10809 git config --global https.proxy http://127.0.0.1:10809 git config --global http.proxy socks5://127.0.0.1:10808 git config --global https.proxy socks5://127.0.0.1:10808 ``` # Show ``` git config --get --global http.proxy git config --get --global https.proxy git config --get --global http.proxy socks5 git config --get --global https.proxy socks5 ``` # Unset ``` git config --global --unset http.proxy git config --global --unset https.proxy git config --global --unset http.proxy socks5 git config --global --unset https.proxy socks5 ``` -
m3y54m created this gist
Dec 30, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # Set Proxy in Terminal (Bash, CMD, PowerShell, etc.) Assume that you want to set 127.0.0.1:10809 as HTTP proxy and 127.0.0.1:10808 as SOCKS proxy. ## CMD (Windowss Command Line) [Configure the proxy server manually using netsh command](https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/configure-proxy-internet?view=o365-worldwide#configure-the-proxy-server-manually-using-netsh-command) ### Tunnel all your internet traffic through a HTTP proxy ``` netsh winhttp set proxy 127.0.0.1:10809 ``` ### Tunnel all your internet traffic through a SOCKS proxy ``` netsh winhttp set proxy proxy-server="socks=127.0.0.1:10808" bypass-list="127.0.0.1" ``` ### View the current proxy settings: ``` netsh winhttp show proxy ``` ### Clear all proxy settings: ``` netsh winhttp reset proxy ```