Send the terminal, Git, Docker and WSL through FlClash
The browser works but git clone hangs. Every tool reads its proxy from a different place. Here they all are.
Published , about 4 min

The system proxy is for programs like browsers. Terminal tools have their own rules: some read environment variables, some their own config, and Docker is another world.
Why the browser and not the terminal? System proxy is a line in settings that programs may read. Browsers do, most command-line tools do not. FlClash is not broken; nobody told the tool.
Two ways
The easy way is TUN. It captures everything and you can skip the rest.
If you don't want TUN, or a work PC won't give you admin rights, set each tool. Ports below use FlClash's default 7890. Change them if yours differs.

The terminal itself
macOS and Linux:
export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890
export all_proxy=socks5h://127.0.0.1:7890
export no_proxy=localhost,127.0.0.1,192.168.0.0/16PowerShell:
$env:HTTPS_PROXY = 'http://127.0.0.1:7890'
$env:HTTP_PROXY = 'http://127.0.0.1:7890'Both last until the window closes. To keep them, put them in ~/.zshrc, ~/.bashrc or PowerShell's $PROFILE. When FlClash is off, commands will then fail to reach 7890, so many people wrap this in a function they call when needed.
The h in socks5h matters: it lets the proxy resolve names. With plain socks5 they're resolved locally and can come back wrong.
Git
For HTTPS repositories:
git config --global http.proxy http://127.0.0.1:7890
git config --global --unset http.proxyThe second line undoes it. SSH repositories ([email protected]:) ignore this and need ~/.ssh/config:
Host github.com
HostName ssh.github.com
Port 443
ProxyCommand nc -X 5 -x 127.0.0.1:7890 %h %pIt also moves to port 443, since some networks block 22. Windows has no nc; use Git's own connect -S 127.0.0.1:7890 %h %p.
npm and pip
npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890
pip install -U pip --proxy http://127.0.0.1:7890If you use a nearby mirror, skip the proxy. It only adds a detour.
Docker
Three things get mixed up in most guides, which is why following half of one doesn't work.
| What you're doing | Where to set it |
|---|---|
Pulling images, docker pull | The daemon's proxy |
Downloads during docker build | Build arguments or client config |
| A running container going online | The container's environment |
Pulling is the usual one. Edit /etc/docker/daemon.json and restart Docker:
{
"proxies": {
"http-proxy": "http://127.0.0.1:7890",
"https-proxy": "http://127.0.0.1:7890",
"no-proxy": "localhost,127.0.0.0/8"
}
}In Docker Desktop, fill in Resources › Proxies instead. Details are in the Docker documentation.
Inside a container, 127.0.0.1 is the container. To reach FlClash on your computer, use host.docker.internal:7890 in Docker Desktop and turn on Allow LAN in FlClash.
WSL2
By default WSL2 is a separate virtual machine, and its 127.0.0.1 isn't Windows. From Windows 11 22H2 you can mirror the network. Create .wslconfig in your Windows user folder:
[wsl2]
networkingMode=mirrored
autoProxy=trueRun wsl --shutdown and reopen. After that, WSL can use 127.0.0.1:7890. Microsoft explains it here.
Check it
curl -I -x http://127.0.0.1:7890 https://www.google.comIf it returns 200, FlClash is fine and the rest is that tool's own setting.
Proxy or network
Run the same command with and without the proxy. Only with: tell the tool. Neither: node or rules.
Functions instead of fixed variables
proxy_on() { export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5h://127.0.0.1:7890; echo on; }
proxy_off() { unset https_proxy http_proxy all_proxy; echo off; }In ~/.zshrc or ~/.bashrc; the same two in PowerShell's $PROFILE.
Where tools read it
| Tool | Variables | Own setting |
|---|---|---|
| curl, wget | Yes | ~/.curlrc, ~/.wgetrc |
| git https | Yes | http.proxy |
| git ssh | No | ~/.ssh/config |
| npm, pnpm, yarn | Yes | config |
| pip | Yes | pip config set global.proxy |
| go | Yes | GOPROXY |
| cargo | Yes | ~/.cargo/config.toml |
| gradle, maven | No | gradle.properties, settings.xml |
| apt | Yes, lost with sudo | /etc/apt/apt.conf.d/ |
| brew | ALL_PROXY | |
| VS Code | Partly | http.proxy |
| ping, nslookup | No | None |
A nearby mirror is better than a proxy where there is one.
Docker
docker build --build-arg https_proxy=http://host.docker.internal:7890 -t app .
docker run -e https_proxy=http://host.docker.internal:7890 appOn Linux add --add-host=host.docker.internal:host-gateway or use 172.17.0.1. Turn on the LAN proxy and open 7890. docker pull belongs to the daemon: restart after editing and check docker info | grep -i proxy.
WSL2 without mirrored mode
- Address
ip route show default, third field - Set
export https_proxy=http://that-address:7890 - FlClashLAN proxy on
- FirewallAllow FlClash on public networks
Still failing with TUN
Nodes may block port 22: use 443. Docker Desktop has its own machine. A company VPN competes for routes. Certificate errors: turn off inspection.
Also asked
https_proxy is set but ping still fails.
Ping uses ICMP, which never goes through an HTTP proxy. Test with curl.
The proxy is gone after sudo.
sudo clears the environment by default. Use sudo -E.
The intranet fails with a proxy?
Put it in no_proxy, in full where wildcards are not supported.
User and password?
http://user:[email protected]:7890, special characters escaped.
VS Code extensions?
http.proxy, or start code after proxy_on.
Read next
Using it46 ms of delay and the video still buffersThe test page is all green and 4K still stalls. Delay and bandwidth are different, and there are a few causes people rarely mention.
Using itRouting you can maintain, with rule providersThousands of copied DOMAIN-SUFFIX lines go stale in months. Three self-updating rule sets leave you with five lines.
How it worksHysteria2, TUIC and Reality: what's the differenceHalf your nodes say hy2, half say reality. Choose by your network. No cryptography needed.