0%

Git 设置代理

最近 Github 越来越连接上了, 加个代理吧!

命令行

全局代理

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

# 必要时需要忽略证书校验
git config --global http.sslVerify false

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

局部网站代理

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

# 必要时需要忽略证书校验
git config --global http.https://github.com.sslVerify false

# 取消代理
git config --global --unset http.https://github.com.proxy
git config --global --unset http.https://github.com.sslVerify

直接修改配置文件(~/.gitconfig)

全局配置

[http]
        proxy = socks5://127.0.0.1:7890
        sslVerify = false

局部网站配置

[http "https://github.com"]
        proxy = socks5://127.0.0.1:7890
        sslVerify = false

引用

  • 本文作者: 6x
  • 本文链接: https://6xyun.cn/article/184
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-ND 许可协议。转载请注明出处!