0

Setting it in local VS Code is straightforward. Setting it for linux via "Settings Sync" also isn't too hard. I want to set it for browser sessions.

Is there either an account-wide settings in codespaces, or a setting I can use in my shell profile (I am using dotfiles), to tell codespaces, "use one shell instead of another for my terminals"?

deitch
  • 14,019
  • 14
  • 68
  • 96

1 Answers1

1

Since you want to do it without settings.sync, you can use project-local settings.json which then resides in your projects .vscode directory.

Open the Command Palette with [ctrl] [p] and type preference: open Workspace Settings (JSON)

This will create an empty local settings.json file for you This will create an empty local settings.json file for you. Copy your desired settings and change them to your needs, this should override your global vscode settings.

Note: These will be project specific settings. If you safe the contents of the .vscode directory in GitHub, they will be persistent in this repository.

Settings sync for the default shell should work out of the Box in the Github Codespace. This is persistent accross sessions and even accross different github repositories.

One funny thing here occurs to me, in some repositories VS Code still opens a bash shell as the first shell, while fish beeing the default. Seems to be something that GitHub does in its default container. But the first shell still isn't the default. Each new terminal that relies on the default selects your configured default shell. Simply open a new default shell and close the "first" one.

maddes8cht
  • 569
  • 3
  • 16
  • settings sync probably would work, although I am looking to understand how to do it without settings sync. So upvote for the useful answer, even if not exactly what I am looking for. And thank you. – deitch Dec 13 '22 at 10:23
  • Okay, i will formulate the complete answer and also have a screenshot for it. Here in short: You can have a project-local settings.json which then resides in your projects .vscode directory. Maybe you will edit your Question accordingly – maddes8cht Dec 13 '22 at 20:52
  • This assumes that it is in one project. I really am just looking for, "I want the default shell for all workspaces in the browser to be x (in my case, zsh, but it doesn't really matter"). – deitch Dec 14 '22 at 08:34
  • I’ve tried using dotfiles for this, using `chsh -s $(which fish) $(whoami)` but the creation log just shows a prompt for password. If I sudo this command, the default shell is updated but you’re still in bash so you would have to log out and back in to get fish as your first shell and we’re right back where we started. Side note; I can acheive a fish shell as first shell using a devcontainer but then thats just repo level and like you, I want a codespace default across any repo I play with. – spaceshipdev Mar 12 '23 at 13:58