forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson-wsl-proxy-setup.json
More file actions
15 lines (15 loc) · 1.12 KB
/
Copy pathlesson-wsl-proxy-setup.json
File metadata and controls
15 lines (15 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"task_id": "lesson-wsl-proxy-setup",
"title": "WSL 代理配置 — 通过 Windows 梯子访问外网",
"domain": "devops",
"tags": [
"wsl",
"proxy",
"network",
"windows"
],
"problem": "WSL 内 `curl google.com` 失败,但 Windows 能正常访问外网。WSL 默认不走 Windows 的代理。",
"solution": "```bash\n# 1. 设置代理环境变量(临时)\nexport http_proxy=http://$(hostname).local:7890\nexport https_proxy=http://$(hostname).local:7890\nexport HTTP_PROXY=$http_proxy\nexport HTTPS_PROXY=$https_proxy\n\n# 2. 永久加入 ~/.bashrc\necho '\nexport http_proxy=http://$(hostname).local:7890\nexport https_proxy=http://$(hostname).local:7890\nexport NO_PROXY=localhost,127.0.0.1,.local\n' >> ~/.bashrc\n\n# 3. git 单独设置(WSL git 不走环境变量)\ngit config --global http.proxy http://$(hostname).local:7890\ngit config --global https.proxy http://$(hostname).local:7890\n```\n\n**注意:** 端口 7890 是常见代理端口,实际端口由你的代理软件决定(Clash 默认 7890,v2ray 默认 10808)。",
"source": "lessons/contrib/wsl-proxy-setup.md",
"test_cmd": ""
}