wsl下socks5快速配置git http 代理

编辑配置文件

vim ~./bashrc

将00000替换为你的端口

export windows_host=`cat /etc/resolv.conf|grep nameserver|awk '{print $2}'`
export ALL_PROXY=socks5://$windows_host:00000
export HTTP_PROXY=$ALL_PROXY
export http_proxy=$ALL_PROXY
export HTTPS_PROXY=$ALL_PROXY
export https_proxy=$ALL_PROXY

if [ "`git config --global --get proxy.https`" != "socks5://$windows_host:00000" ]; then
            git config --global proxy.https socks5://$windows_host:00000
fi

重新加载配置文件

source ~/.bashrc
posted @ 2024-12-31 10:20  PhyKnife  阅读(95)  评论(0)    收藏  举报