新建一个 C:\Users\你的用户名.ssh\config 文件(没有扩展名,如果已存在此文件则不用新建),编辑此文件增加以下内容:
Host github.com *.github.com
User git
ProxyCommand connect -S 127.0.0.1:7890 %h %p
其中 Host 右边为需要走代理的域名列表,127.0.0.1:7890 替换为自己的代理服务器地址。 git clone http(s) 走代理
git config --global http.proxy "http://127.0.0.1:7890"
git config --global https.proxy "http://127.0.0.1:7890"
其中 127.0.0.1:7890 替换为自己的代理服务器地址。 转载自[imageoo]: https://www.imaegoo.com/2023/git-clone-ssh-proxy/ 仅收藏备用