Last active
September 16, 2023 16:27
-
-
Save Howard20181/31e61599ecb069483448c03649810c75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST_IP=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }') | |
PROXY_PORT="7890" | |
PROXY_HTTP="http://${HOST_IP}:${PROXY_PORT}" | |
export {http,https,ftp}_proxy="$PROXY_HTTP" | |
export {HTTP,HTTPS,FTP}_PROXY="$PROXY_HTTP" | |
git config --global http.proxy "$PROXY_HTTP" | |
git config --global https.proxy "$PROXY_HTTP" |
最新的 WSL2 疑似有意禁止访问本机网络。
HTTP 访问 cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }'
得出的地址和本机局域网 IP 均会超时,检查过防火墙设置,而且局域网内其他设备上的客户端都可以访问。
最新的 WSL2 疑似有意禁止访问本机网络。
HTTP 访问
cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }'
得出的地址和本机局域网 IP 均会超时,检查过防火墙设置,而且局域网内其他设备上的客户端都可以访问。
最新有多新?是Windows更新导致的还是WSL更新导致的?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
简单说一下怎么用
用wget下载脚本到 ~
往~/.bashrc追加一行
. ~/WSL2SetProxy.sh