Clash Verge 可以用于配置 Git 代理,具體方法如下:
1. HTTPS 代理設(shè)置
在 Clash Verge 中啟用代理后,通過以下命令為 Git 配置 HTTPS 代理(假設(shè)代理端口為 7890):
git config --global http.proxy 'http://127.0.0.1:7890'
git config --global https.proxy 'http://127.0.0.1:7890'
若需移除代理,執(zhí)行:
git config --global --unset http.proxy
git config --global --unset https.proxy
2. SSH 代理設(shè)置
編輯 ~/.ssh/config 文件(Windows 路徑為 C:\Users\<用戶名>\.ssh\config),添加以下內(nèi)容:
Copy Code
Host github.com
ProxyCommand connect -S 127.0.0.1:7890 %h %p
此配置會通過 Clash Verge 的 SOCKS5 代理(默認端口 7890)中轉(zhuǎn) SSH 流量
3. 注意事項
確保 Clash Verge 的代理模式為 Global 或 Rule(避免直連模式影響代理生效)