1
2
3
git config --global http.proxy 'http://127.0.0.1:10808'

git config --global https.proxy 'http://127.0.0.1:10808'
1
git config --global http.proxy 'socks5://127.0.0.1:10808'

设置完之后可以使用这个命令查看 Git 的配置。

1
git config --list

想退出查看界面的话就按下 Q 键。

当然还可以使用这个命令直接编辑 Git 的配置文件。

1
git config --global --edit

打开配置文件之后会是这样的。

1
2
3
4
5
6
7
[http]

proxy = http://127.0.0.1:10808

[https]

proxy = http://127.0.0.1:10808