更新插件失败 #45
-
如题,最开始跟着小册做的时候就遇到过这个问题,是通过切换init.lua 中的 git 设置解决的,但是现在没用了。
没办法了 .... 绝望..... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
首先确定挂上梯子的时候可以访问 twitter 之类的网站。 然后复制终端代理命令,复制出来的大概是这样
好像还要加上两条 git 代理
如果你用 mac 或者某些 linux,就把这些贴到 我的 Mac 下用的这个代码,可以 proxy 和 unproxy 随时切换代理。 # proxy -----------------------------------------------------
alias ip="curl -i cip.cc"
export SOCKS5_ADDR="socks5://127.0.0.1:1086"
export HTTP_ADDR="http://127.0.0.1:1086"
function proxy() {
export all_proxy="$SOCKS5_ADDR"
export http_proxy="$HTTP_ADDR"
export https_proxy="$HTTP_ADDR"
export ALL_PROXY="$SOCKS5_ADDR"
export HTTP_PROXY="$HTTP_ADDR"
export HTTPS_PROXY="$HTTP_ADDR"
# git
git config --global http.proxy "$HTTP_ADDR"
git config --global https.proxy "$HTTP_ADDR"
# npm
# npm config set proxy "$HTTP_ADDR"
# npm config set https-proxy "$HTTP_ADDR"
# npm config set registry http://registry.npmjs.org/
# npm config set strict-ssl false
# declare
echo "current proxy status: using $PROXY_ADDR, proxying"
ip
}
function unproxy() {
unset all_proxy
unset http_proxy
unset https_proxy
unset ALL_PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
# git
git config --global --unset http.proxy
git config --global --unset https.proxy
# npm
# npm config delete proxy
# npm config delete https-proxy
# npm config delete registry
# npm config delete strict-ssl
# declare
echo "current proxy status: direct connect, not proxying"
ip
} 但是如果用 windows 就比较麻烦一点,因为梯子是挂在 windows 下边的,而 WSL2 和 windows 类似在一个局域网中,但两者的 ip 不同,所以需要在梯子上设置允许局域网连接,在wsl2中首先要获取windows的 ip ,好像要把 大概原理是这样,具体要搜个教程跟着做一下,比如这个
搜了一下我之前 windows电脑上 好像用的这一段,把它加到 bashrc 里,打开命令行 输入proxy 回车试试 # 代理相关 proxy() unPorxy
#
# https://blog.nediiii.com/wsl2-note/
export HOST_IP=$(grep -oP '(?<=nameserver\ ).*' /etc/resolv.conf)
export PROXY_ADDR="http://${HOST_IP}:1080"
# GLOBAL PROXY FOR BASH
# if ~/.bash_proxy not exist , then create it.
if [ ! -f ~/.bash_proxy ]; then
touch ~/.bash_proxy
fi
# execute ~/.bash_proxy
. ~/.bash_proxy
alias ip="curl -i cip.cc"
function proxy() {
export all_proxy="$PORXY_ADDR"
export http_proxy="$PORXY_ADDR"
export https_proxy="$PORXY_ADDR"
export ALL_PROXY="$PORXY_ADDR"
export HTTP_PROXY="$PORXY_ADDR"
export HTTPS_PROXY="$PORXY_ADDR"
echo -e "export {all_proxy,http_proxy,https_proxy,ALL_PROXY,HTTP_PROXY,HTTPS_PROXY}=\"$PROXY_ADDR\";" | tee ~/.bash_proxy >/dev/null
# apply
. ~/.bash_proxy
# git
git config --global http.proxy "socks5://$HOST_IP:1080"
git config --global https.proxy "socks5://$HOST_IP:1080"
# declare
echo "current proxy status: using $PROXY_ADDR, proxying"
ip
}
function unproxy() {
# unset all_proxy http_proxy https_proxy ALL_PROXY HTTP_PROXY HTTPS_PROXY
echo -e "unset all_proxy http_proxy https_proxy ALL_PROXY HTTP_PROXY HTTPS_PROXY" | tee ~/.bash_proxy >/dev/null
# apply
. ~/.bash_proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
# declare
echo "current proxy status: direct connect, not proxying"
ip
}
|
Beta Was this translation helpful? Give feedback.
-
使用wsl2的话直接用clash for windows 开个 tun模式就能让虚拟机走代理了,不太需要各种配置。 |
Beta Was this translation helpful? Give feedback.
-
说一下我的方法: # 代理相关 proxy() unPorxy
#
# https://blog.nediiii.com/wsl2-note/
export HOST_IP=$(grep -oP '(?<=nameserver\ ).*' /etc/resolv.conf)
export PROXY_ADDR="http://${HOST_IP}:7890"
# GLOBAL PROXY FOR BASH
# if ~/.bash_proxy not exist , then create it.
if [ ! -f ~/.bash_proxy ]; then
touch ~/.bash_proxy
fi
# execute ~/.bash_proxy
. ~/.bash_proxy
alias public_ip="curl -i cip.cc"
function proxy() {
export all_proxy="$PORXY_ADDR"
export http_proxy="$PORXY_ADDR"
export https_proxy="$PORXY_ADDR"
export ALL_PROXY="$PORXY_ADDR"
export HTTP_PROXY="$PORXY_ADDR"
export HTTPS_PROXY="$PORXY_ADDR"
echo -e "export {all_proxy,http_proxy,https_proxy,ALL_PROXY,HTTP_PROXY,HTTPS_PROXY}=\"$PROXY_ADDR\";" | tee ~/.bash_proxy >/dev/null
# apply
. ~/.bash_proxy
# git
git config --global http.proxy "socks5://$HOST_IP:7890"
git config --global https.proxy "socks5://$HOST_IP:7890"
# declare
echo "current proxy status: using $PROXY_ADDR, proxying"
public_ip
}
function unproxy() {
# unset all_proxy http_proxy https_proxy ALL_PROXY HTTP_PROXY HTTPS_PROXY
echo -e "unset all_proxy http_proxy https_proxy ALL_PROXY HTTP_PROXY HTTPS_PROXY" | tee ~/.bash_proxy >/dev/null
# apply
. ~/.bash_proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
# declare
echo "current proxy status: direct connect, not proxying"
public_ip
} 主要是 @nshen 大佬提供的代码,但我更新下 |
Beta Was this translation helpful? Give feedback.
首先确定挂上梯子的时候可以访问 twitter 之类的网站。
然后复制终端代理命令,复制出来的大概是这样
好像还要加上两条 git 代理
如果你用 mac 或者某些 linux,就把这些贴到
~/.bashrc
或者~/.zshrc
里就可以了,重开终端后curl -i cip.cc
看到的应该是你梯子的ip,说明命令行代理成功了。我的 Mac 下用的这个代码,可以 proxy 和 unproxy 随时切换代理。