Git代理设置之后无法push

时间:2019-02-21
本文章向大家介绍Git代理设置之后无法push,主要包括Git代理设置之后无法push使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

今天在使用git push到github的时候遇到了这样的错误

$ git push
fatal: NotSupportedException encountered.
   ServicePointManager 不支持具有 socks5 方案的代理。

造成无法直接使用公钥push,需要手动输入用户名以及密码才能push

一开始以为是设置了环境变量代理 使用env|grep proxy发现没有查到

后来记起来之前的时候嫌弃github下载太慢配置了git config

贴一段处理的方式防止自己忘记了

// 查看当前代理设置
git config --global http.proxy
git config --global https.proxy

// 设置当前代理为 http://127.0.0.1:1080 或 socket5://127.0.0.1:1080
git config --global http.proxy 'http://127.0.0.1:1080'
git config --global https.proxy 'http://127.0.0.1:1080'

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

// 删除 proxy
git config --global --unset http.proxy
git config --global --unset https.proxy