📝 Git代理设置

← 返回笔记列表

Git代理设置

2026年05月20日 08:56

CONFIG设置

--local 仓库配置
--global 用户配置
--system 系统配置

git config --global credential.helper store
git config --global --unset credential.helper
git config --system --unset credential.helper
git config --global user.email "your-email@example.com"
git config --global user.name "LiuQing"

克隆新库

git clone -c http.proxy="http://IP:8089" http://gitlab.example.com/MPC/mpc-auth.git

设置http/https代理

git config --local http.proxy 'x.x.x.x:8089'
git config --local https.proxy 'x.x.x.x:8089'
git config --global http.proxy 'socks5://x.x.x.x:1080' 
git config --global https.proxy 'socks5://x.x.x.x:1080'

使用git://协议

git config core.gitProxy 'socks5://127.0.0.1:1080'

取消代理

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

Github访问加速

https://tool.chinaz.com/dns?host=github.com
https://tool.chinaz.com/dns?host=github.global.ssl.fastly.net
cat >>/etc/hosts<<EOF 
140.82.112.3 github.com
151.101.1.194 github.global.ssl.fastly.net
185.199.111.133 objects.githubusercontent.com
185.199.108.133 objects.githubusercontent.com
185.199.109.133 objects.githubusercontent.com
185.199.110.133 objects.githubusercontent.com
EOF
返回顶部 ← 返回笔记列表