1、给git设置代理,使git工具以及命令的网络走代理工具,实现魔法上网:

1
2
3
4
5
6
# 设置
git config --global http.proxy http://127.0.0.1:1087
git config --global https.proxy http://127.0.0.1:1087
# 恢复默认
git config --global --unset http.proxy
git config --global --unset https.proxy

文中的代理地址,需根据自己的代理工具设置,可参考:

git clone 加速 | 爱睡觉的云☁️ (huapeng222.github.io)

2、给终端设置代码,使终端命令的网络走代理工具,实现魔法上网:

1
2
export http_proxy=http://127.0.0.1:1087
export https_proxy=$http_proxy

该命令仅在设置的终端窗口生效,如需恢复,直接关闭窗口,新建一个即可。

文中的代理地址,需根据自己的代理工具设置,可参考:

git clone 加速 | 爱睡觉的云☁️ (huapeng222.github.io)