git 教程

全局配置

代理

有时候我们即使开了 VPN ,git 相关操作好像还是会很慢,这大概率就是因为本地的 git 还没有配置代理,可以通过下面的命令来设置:

# 使用 socks5 代理
git config --global http.proxy 'socks5://127.0.0.1:7890'
git config --global https.proxy 'socks5://127.0.0.1:7890'

# 使用 http 代理
git config --global http.proxy 'http://127.0.0.1:7890'
git config --global https.proxy 'http://127.0.0.1:7890'

# 验证配置
git config --global --get http.proxy
git config --global --get https.proxy

# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy