访问github经常失败,使用代理可以使访问更加顺滑。
格式
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:port
git config --global https.proxy https://proxyUsername:proxyPassword@proxy.server.com:port
git config --global http.http://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
git config --global https.https://domain.com.proxy https://proxyUsername:proxyPassword@proxy.server.com:port
以下是例子:
http代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
socks5代理
git config --global http.proxy socks5://127.0.0.1:1081
仅为github.com设置代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1081
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
查看当前的代理配置
git config --global --get http.proxy
git config --global --get https.proxy
本文介绍了如何通过gitconfig命令行工具配置http和https代理,包括全局代理、socks5代理以及针对特定域名如github.com的代理设置。还提供了取消代理和查看现有配置的方法。
2345

被折叠的 条评论
为什么被折叠?



