CLI tools ignore the Windows system proxy - the root cause of "browser works, terminal doesn't". Here are the standard ways to route them through Clash; the same commands double as excellent diagnostics.
curl: the quickest chain check
# without proxy - your local exit
curl https://api.ip.sb/ip
# through Clash - the node's exit
curl -x http://127.0.0.1:7890 https://api.ip.sb/ip
# SOCKS5 flavor (the mixed port speaks both)
curl --socks5 127.0.0.1:7890 https://api.ip.sb/ip
Two different IPs prove the chain works. Add -v to watch the handshake and pinpoint failures.
Environment variables: session-wide
Most CLI tools (curl, wget, pip, go, …) honor http_proxy/https_proxy:
# PowerShell
$env:http_proxy = "http://127.0.0.1:7890"
$env:https_proxy = "http://127.0.0.1:7890"
# CMD
set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890
Effective only in the current terminal, gone when it closes - usually exactly what you want. System-wide env vars work too but are easy to forget, and every terminal loses connectivity whenever Clash is off.
Per-tool configuration
# Git
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
# undo:
git config --global --unset http.proxy
# npm
npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890
# SSH through the proxy ([email protected], in ~/.ssh/config)
Host github.com
ProxyCommand connect -S 127.0.0.1:7890 %h %p