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

附录

我的代理端口截图如下:

相关推荐
qq_316837752 小时前
IP网段冲突 配置指定ip使用指定的网络接口发送,而不经过默认网关
服务器·网络·tcp/ip
布史2 小时前
Tailscale虚拟私有网络指南
linux·网络
枷锁—sha3 小时前
彻底解决 Google Gemini 报错:异常流量与 IP 地址冲突排查指南
网络·网络协议·tcp/ip
Xの哲學3 小时前
深入剖析Linux文件系统数据结构实现机制
linux·运维·网络·数据结构·算法
-To be number.wan4 小时前
经典真题精讲|2010年408统考第34题:文件传输最少需要多久?
网络·计算机网络
wxr06164 小时前
GIT学习
git·学习
知乎的哥廷根数学学派5 小时前
基于多尺度注意力机制融合连续小波变换与原型网络的滚动轴承小样本故障诊断方法(Pytorch)
网络·人工智能·pytorch·python·深度学习·算法·机器学习
猫头虎5 小时前
2026最新|GitHub 启用双因素身份验证 2FA 教程:TOTP.app 一键生成动态验证码(新手小白图文实操)
git·开源·gitlab·github·开源软件·开源协议·gitcode
好多渔鱼好多5 小时前
【流媒体协议】RTSP / RTP / RTCP 协议全景介绍
网络·网络协议·rtp·rtsp·rtcp·ipc摄像头
映秀小子6 小时前
Wireshark加减显示列
网络·测试工具·wireshark