01

Your shell ignores the system proxy

A system proxy only affects programs that read the system settings. Most command line tools do not. They look at the http_proxy and https_proxy environment variables, or at their own config files. So git clone timing out while the browser works perfectly is expected behaviour, not a broken client.

Two exceptions are worth remembering up front. TUN mode intercepts at the network layer, so command line tools work with no configuration at all. SSH, on the other hand, never honours http_proxy under any circumstances and needs a ProxyCommand.

SponsoredWhere does the subscription link come from?Our partner provider gives you 1 GB of high-speed Hong Kong data at signup — import it in one click.Get high-speed nodes
02

Configure it tool by tool

  1. 1

    Environment variables, for this session

    On Linux and macOS export https_proxy and http_proxy pointing at http://127.0.0.1:7897. In PowerShell assign the same value to $env:HTTPS_PROXY. It only lasts as long as the window. Put it in .bashrc or your PowerShell profile to make it permanent.

  2. 2

    Git

    Set git config --global http.proxy to the proxy address, and the same for https. To proxy only GitHub, use the URL-scoped form git config --global http.https://github.com/.proxy. Remove any of them with --unset.

  3. 3

    npm and pip

    npm config set proxy configures a proxy; registry changes the mirror. They are different things, so do not mix them up. pip takes --proxy for one-off runs or the same value in pip.conf, though a nearby mirror is often faster than a proxy.

  4. 4

    SSH

    Add a ProxyCommand line for the relevant Host in ~/.ssh/config. On Linux and macOS nc -X 5 -x is the common choice for SOCKS5; on Windows the connect helper shipped with Git works well.

03

Verify it, and the usual typos

Run curl against ipinfo.io/ip. If the address it returns is your node, the proxy is in use. If curl works but git does not, check that one setting on its own with git config --global --get http.proxy.

  • https_proxy starts with http://, not https://; the scheme describes the proxy server itself
  • No trailing slash and no path on the proxy address
  • Use no_proxy for localhost, 127.0.0.1 and any internal company domains
04

Common questions

I set the variables and still get connection refused.

In order of likelihood: wrong port number, the client is not running, or the value starts with https://. Compare the mixed port shown in the client with what you typed.

Internal addresses stopped working after I set a proxy.

Add your internal domains and subnets to no_proxy, along with localhost and 127.0.0.1. Git and npm have their own separate no-proxy settings as well.