git中设置代理

  说明:在某种原因下,整个网络都是使用代理的情况下,需要使用git clone,这时就需要设置代理了。

  在没有设置代理的时候,直接克隆报错  Failed to connect to gitee.com port 443: Connection refused

   在git中设置proxy

    设置Socks5代理

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

    设置http/https代理

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

    取消代理

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

    再次git clone,成功下载

 

原文地址:https://www.cnblogs.com/gqzdev/p/11881536.html