git 配置网络代理

提高 git 访问 github 速度

网络代理前提:

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

文章目录

  • [1. git 配置参数列表命令:](#1. git 配置参数列表命令:)
  • [2. git 添加 http 代理](#2. git 添加 http 代理)
  • [3. git 取消 http 代理](#3. git 取消 http 代理)

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

bash 复制代码
git config --list

2. git 添加 http 代理

两个http 差别不大,只是增加(或减少)一个字母 s

选择下面其中一个就可以。

  1. http / https 代理

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

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

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

bash 复制代码
git config --global http.proxy 'socks5://127.0.0.1:10808'
bash 复制代码
git config --global https.proxy 'socks5://127.0.0.1:10808'

3. git 取消 http 代理

bash 复制代码
git config --global --unset http.proxy
bash 复制代码
git config --global --unset https.proxy

参考

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

附录

我的代理端口截图如下:

相关推荐
江畔何人初2 小时前
iptables 和 IPVS 代理模式 Service 的区别
linux·运维·服务器·网络·云原生·kubernetes·代理模式
123过去5 小时前
nfc-list使用教程
linux·网络·测试工具·安全
KaneLogger5 小时前
OpenCode 操作手册
git
木子小喵5 小时前
通俗讲解Git安装每一步!!
git
攻城狮在此6 小时前
华三交换机链路聚合配置(三层聚合)
网络·华为
IOT那些事儿6 小时前
TortoiseGit拉取开源子仓库失败
git·ssh·tortoisegit·submodule
evo-master6 小时前
网络故障排除方法
linux·服务器·网络
Johnstons7 小时前
网络流量监控工具怎么选
运维·网络·网络故障排除·网络流量分析·网络性能监控
不想看见4047 小时前
Git的多种仓库选择与推荐
git
jiankeljx9 小时前
Java实战:Spring Boot application.yml配置文件详解
java·网络·spring boot