美文网首页工具
Windows git和cmd代理设置

Windows git和cmd代理设置

作者: Avey777 | 来源:发表于2019-04-30 16:10 被阅读0次

    linux的比较简单,直接修改配置文件即可,这里就不再赘述

    设置Git代理

    http代理:

    临时代理:

    export http_proxy=http://127.0.0.1:7777
    export https_proxy=http://127.0.0.1:7777

    永久代理:

    命令方式:
    git config --global http.proxy http://127.0.0.1:50015
    git config --global https.proxy http://127.0.0.1:50015

    修改配置文件方式
    进入用户名根路径,找到 .gitconfig 文件,修改(地址和端口换成自己的)为:

    [http]
    proxy = http://127.0.0.1:50015
    [https]
    proxy = http://127.0.0.1:50015

    查看http (s)代理情况:

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

    永久代理 - SOCKS5 代理设置

    命令方式:
    git config --global http.proxy socks5://127.0.0.1:50014
    git config --global https.proxy socks5://127.0.0.1:50014

    修改配置文件方式:
    进入用户名根路径,找到 .gitconfig 文件,修改(地址和端口换成自己的)为:

    [http]
    proxy = socks5://127.0.0.1:50015
    [https]
    proxy = socks5://127.0.0.1:50015

    查看SOCKS5 代理情况:

    git config --get --global http.proxy
    git config --get --global https.proxy
    git config --get --global http.proxy socks5
    git config --get --global https.proxy socks5

    git取消http(s)或socks代理:

    git config --system (或 --global 或 --local) --unset http.proxy
    例:
    git config --global --unset http.proxy
    git config --global --unset https.proxy

    ----------------------------------------------------------------------------------------------------------------------------------------

    设置CMD代理

    CMD - http代理

    cmd临时代理方案(cmd窗口关闭,则代理失效)
    set http_proxy=http://127.0.0.1:50015
    set https_proxy=http://127.0.0.1:50015

    cmd永久代理方案
    netsh winhttp import proxy source=ie

    CMD - SOCKS5 代理设置

    set http_proxy=socks5://127.0.0.1:50014
    set https_proxy=socks5://127.0.0.1:50014

    CMD(服务器)针对性代理,绕过本地请求(修改为自己的代理地址和端口)

    http:
            netsh winhttp set proxy proxy-server="http=192.168.17.100:50015" bypass-list="localhost"
    https:
            netsh winhttp set proxy proxy-server="http=192.168.17.100:50015" bypass-list="localhost"
    socks:
            netsh winhttp set proxy proxy-server="socks=192.168.17.100:50015" bypass-list="localhost"
    
    CMD查看代理情况:

    netsh winhttp show proxy

    CMD取消代理:

    netsh winhttp reset proxy

    相关文章

      网友评论

        本文标题:Windows git和cmd代理设置

        本文链接:https://www.haomeiwen.com/subject/pmsvnqtx.html