GitHub 克隆与 git push 走机场代理设置教程(HTTPS 与 SSH)
核心结论
在终端配置 `git config --global http.https://github.com.proxy` 即可让 HTTPS 仓库走本地代理端口;SSH 协议则可通过 `~/.ssh/config` 配合 `ProxyCommand` 转发。
一、HTTPS 方式设置 Git 代理
执行 `git config --global http.https://github.com.proxy http://127.0.0.1:7897`(端口按你客户端实际端口调整),只针对 GitHub 生效,不影响国内 Gitee/GitLab。
二、SSH 方式设置代理
在 `~/.ssh/config` 中为 `Host github.com` 添加 `ProxyCommand connect -S 127.0.0.1:7897 %h %p`(Windows Git Bash 自带 `connect` 工具)。
若尚未选定服务商,可前往 机场综合排行榜 或 横向对比工具 查看 14 家收录品牌参数。
站内相关专题与延展阅读