一、为 Git 单独配置与取消代理
假设本地 Clash 端口为 7890,执行:git config --global http.proxy http://127.0.0.1:7890;不需要时取消:git config --global --unset http.proxy。
二、通用 Shell 环境变量与 Docker
在 macOS/Linux zsh 中可定义快捷别名 alias proxy="export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890" 按需开启;Docker Daemon 拉取镜像则需在 systemd service override 中配置 HTTP_PROXY / HTTPS_PROXY 并重载守护进程。