git 配置网络代理

提高 git 访问 github 速度

网络代理前提:

  • 开启代理(梯子)
  • 检查代理端口(可能会有所不同)

1. git 配置参数列表命令:

git config --list

2. git 添加 http 代理

两个http 差别不大,只是增加(或减少)一个字母 s
选择下面其中一个就可以。

  1. http / https 代理

根据 http 端口设置,我这里端口为 10809

git config --global http.proxy http://127.0.0.1:10809
git config --global https.proxy https://127.0.0.1:10809
  1. socks 代理

根据 socks 端口设置,我这里端口为 10808

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

3. git 取消 http 代理

git config --global --unset http.proxy
git config --global --unset https.proxy

参考

  1. git 设置网络代理,修改http.proxy

附录

我的代理端口截图如下:

在这里插入图片描述

posted @ 2023-08-14 22:32  辰梦starDream  阅读(8)  评论(0编辑  收藏  举报  来源