avatar

proxy

代理相关

yarn 的代理

1
2
yarn config set proxy http://127.0.0.1:7890
yarn config set https-proxy http://127.0.0.1:7890

解释:实际上修改的是 ~/.yarnrc 文件

Git 的代理

HTTP 代理

1
git config --global http.https://github.com.proxy http://127.0.0.1:7890

解释:实际上修改的是 ~/.gitconfig 文件

SSH 的代理

HTTP 代理

1
vim ~/.ssh/config
1
2
3
Host github.com
User git
ProxyCommand connect -H 127.0.0.1:7890 %h %p

配置完成

注意:要重启终端

取消代理

当你没使用代理软件的时候如果直接使用 yarn、Git、ssh 会报错,所以最好的做法就是使用这些工具的时候翻墙,如果不翻墙的时候就把修改的文件内容注释掉即可(我没想错的话就是在相应行的开头加上 # 这个符号)

文章作者: guardianss
文章链接: https://guardianss.github.io/proxy.html
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Guardian
打赏
  • 微信
    微信
  • 支付寶
    支付寶

评论