JerryFaraday's Blog

Git代理设置

字数统计: 171阅读时长: 1 min
2023/10/05

Git设置代理

  鉴于笔者在一个月内两次分别在MacOS和Windows和终端斗智斗勇,未避免可预见的未来在Linux上复现这一情况,写个blog记录下

设置 HTTP/HTTPS 代理

1
2
3
4
git config --global --add http.proxy localhost:7890
git config --global --add http.sslVerify false
git config --global --add https.proxy localhost:7890
git config --global --add https.sslVerify false

设置 socks5 代理

1
2
3
4
git config --global --add http.proxy socks5://localhost:7890
git config --global --add http.sslVerify false
git config --global --add https.proxy socks5://localhost:7890
git config --global --add https.sslVerify false

取消代理设置

1
2
3
4
git config --global --unset http.proxy
git config --global --unset http.sslVerify
git config --global --unset https.proxy
git config --global --unset https.sslVerify

若曾设置过多个代理

1
2
git config --global --unset-all http.proxy
git config --global --unset-all https.proxy
CATALOG
  1. 1. Git设置代理
    1. 1.1. 设置 HTTP/HTTPS 代理
    2. 1.2. 设置 socks5 代理
    3. 1.3. 取消代理设置