You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为浏览器端GitHub Codespaces设置默认Shell?

Codespaces 设置默认终端 Shell

一、账户全局设置

GitHub 提供了账户级别的 Codespaces 默认 Shell 设置,所有新创建的 Codespaces 都会自动沿用这个配置:

  • 进入你的 GitHub 账户设置页面,找到「Codespaces」选项
  • 在「Default shell」下拉列表中选择你偏好的 Shell(比如 zsh、bash、fish 等)
  • 保存设置后,后续新建的 Codespaces 终端就会默认使用你选的 Shell

二、通过 dotfiles 配置

如果用 dotfiles 管理个人配置,有两种方式可以指定 Codespaces 的默认 Shell:

  1. 修改系统默认登录 Shell
    在 dotfiles 的安装脚本(比如 install.sh)里添加一行命令,直接修改用户的默认登录 Shell:
    chsh -s $(which zsh)
    替换 zsh 为你想用的 Shell 即可,这样每次 Codespaces 同步 dotfiles 后,会自动把默认登录 Shell 改成你指定的。

  2. 配置 VS Code 终端默认 Profile
    在 dotfiles 中添加 .vscode/settings.json 文件,写入以下配置:

{
  "terminal.integrated.defaultProfile.linux": "zsh"
}

这个配置会直接指定 VS Code(包括浏览器端 Codespaces)的终端默认使用的 Shell Profile,生效范围覆盖当前 Codespaces 会话。

内容的提问来源于stack exchange,提问作者deitch

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 19:10:27