Skip to content

Instantly share code, notes, and snippets.

@7aman
Forked from m3y54m/terminal-proxy-settings.md
Created March 4, 2026 04:39
Show Gist options
  • Select an option

  • Save 7aman/1b7f8dc857b5ae50395f0d9b4aca1d8e to your computer and use it in GitHub Desktop.

Select an option

Save 7aman/1b7f8dc857b5ae50395f0d9b4aca1d8e to your computer and use it in GitHub Desktop.

Revisions

  1. @m3y54m m3y54m revised this gist Dec 30, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions terminal-proxy-settings.md
    Original 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
    ### 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
    ### Unset

    ```
    git config --global --unset http.proxy
  2. @m3y54m m3y54m revised this gist Dec 30, 2022. 1 changed file with 71 additions and 3 deletions.
    74 changes: 71 additions & 3 deletions terminal-proxy-settings.md
    Original 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.

    ## CMD (Windowss Command Line)
    [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
    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="127.0.0.1"
    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
    ```
  3. @m3y54m m3y54m created this gist Dec 30, 2022.
    33 changes: 33 additions & 0 deletions terminal-proxy-settings.md
    Original 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
    ```