Git使用代理

  1. 通过命令修改全局代理

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

不同的代理方式和代理端口根据情况做相应修改

  1. 直接修改用户目录下的.gitconfig文件

    [http]
            proxy = socks5://127.0.0.1:7890
    [https]
            proxy = socks5://127.0.0.1:7890
    
  2. 只对github使用代理

    git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
    
    #取消代理
    git config --global --unset http.https://github.com.proxy)
    
posted @ 2021-07-06 16:33  云子墨  阅读(92)  评论(0编辑  收藏  举报