终端走一下代理 git加速

  1. 安装和配置privoxy

    sudo apt install privoxy 
    sudo gedit /etc/privoxy/config
    #配置config,在/etc/privoxy/config 可在1337行或文件末尾加上如下内容
     forward-socks5 / localhost:1080 .
    
  2. 终端启动代理

    sudo gedit ~/.bashrc
    复制如下内容,加到最后面
    startvpn(){
    sudo /etc/init.d/privoxy restart
    export http_proxy='http://127.0.0.1:8118'
    export https_proxy='http://127.0.0.1:8118'
     echo "设置代理"
    }
    stopvpn(){
    unset http_proxy
     unset https_proxy
     echo "取消代理"
    }
    生效一下修改
    source ~/.bashrc
    启动代理,终端输入
    startvpn
    关闭代理
    stopvpn
    
  3. git加速

    配置.gitconfig文件
    sudo gedit ~/.gitconfig
    复制如下内容
    [http]
    	postBuffer = 524288000
    	lowSpeedLimit = 0
    	lowSpeedTime = 999999
    	proxy = socks5://127.0.0.1:1080
    [https "https://github.com"]
        proxy = socks5://127.0.0.1:1080
    
发布了93 篇原创文章 · 获赞 29 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/ljl1015ljl/article/details/102793180