Skip to content

Instantly share code, notes, and snippets.

@rasulsh
Forked from m3y54m/terminal-proxy-settings.md
Created November 7, 2025 14:24
Show Gist options
  • Select an option

  • Save rasulsh/42722ec370e8c1b197e97a1feb95dec2 to your computer and use it in GitHub Desktop.

Select an option

Save rasulsh/42722ec370e8c1b197e97a1feb95dec2 to your computer and use it in GitHub Desktop.
Set Proxy in Terminal (Bash, CMD, PowerShell, etc.)

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.

How to set a proxy for CMD/Powershell/Terminal/Git

CMD / PowerShell Using netsh

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:

netsh winhttp show proxy

Clear all proxy settings:

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment