﻿---
title: "WSL 把仓库放进 Linux 家目录，不要在 /mnt/c 上跑"
summary: "0.115 起只要 WSL2。CLI 在发行版里装。路径走 ~/code，不要走 Windows 盘挂载。IDE 另开 chatgpt.runCodexInWindowsSubsystemForLinux。"
category: sandbox
level: intermediate
surfaces: [cli, ide]
tags: ["WSL", "Windows", "路径"]
canonical: /tips/wsl-linux-home-not-mntc/
---

# WSL 把仓库放进 Linux 家目录，不要在 /mnt/c 上跑

0.115 起只要 WSL2。CLI 在发行版里装。路径走 ~/code，不要走 Windows 盘挂载。IDE 另开 chatgpt.runCodexInWindowsSubsystemForLinux。

WSL1 只支持到 Codex `0.114`。之后 Linux 沙箱改成 bubblewrap，必须 WSL2。

在提升权限的 PowerShell 里装发行版，再进 Linux shell 装 CLI：

```powershell
wsl --install
wsl
```

```bash
curl -fsSL https://chatgpt.com/codex/install.sh | sh
mkdir -p ~/code && cd ~/code
git clone git@github.com:you/repo.git
cd repo
codex
```

`/mnt/c/...` 又慢又容易踩符号链接和权限。Windows 资源管理器用 `\\wsl$\Ubuntu\home\<user>` 看同一份文件。VS Code 在 WSL 终端里 `code .`，状态栏应显示 `WSL: ...`，确认：

```bash
echo $WSL_DISTRO_NAME
which codex || echo "codex not found"
```

IDE 扩展要在编辑器设置里打开 `chatgpt.runCodexInWindowsSubsystemForLinux`（改完会重载窗口）。仓库仍在 `C:\` 时不要开这项。大仓卡顿先 `wsl --update` 再 `wsl --shutdown`，不要先去调沙箱。

## 来源

- [OpenAI · WSL](https://learn.chatgpt.com/docs/windows/wsl)
