最近国内访问 github 越来越不稳定,git bash 上传或下载代码时总是提示超时,参考Composer 国内安装太慢的终极解决方案,2024最完美稳定版。决定给 git bash 也设置一下代理,步骤基本相同:

打开 git bash,然后输入

git config --global http.proxy "http://127.0.0.1:12345"
git config --global https.proxy "https://127.0.0.1:12345"

这样设置之后,git 的速度基本能跑满带宽

注意,这种方式只适用于 http 方式访问 git,不适用于 ssh 方式。

具体的代理端口,请根据你实际的情况设置,我这里用的是 12345。