How can one shutdown GitHub Codespaces to avoid extra costs?
From the Command Palette you can explicitly stop a codespace:
You can access that quickly from the >< Codespaces option in the status bar.
And other options to stop a codespace from the official docs:
Closing or stopping your codespace
Your codespace will keep running while you are using it, but will time out after a period of inactivity. File changes from the editor and terminal output are counted as activity, so your codespace will not time out if terminal output is continuing. The default inactivity timeout period is 30 minutes. You can define your personal timeout setting for codespaces you create, but this may be overruled by an organization timeout policy. For more information, see "Setting your timeout period for GitHub Codespaces."
If a codespace times out it will stop running, but you can restart it from the browser tab (if you were using the codespace in the browser), from within VS Code, or from your list of codespaces at https://github.com/codespaces.
To stop your codespace you can
- In the browser: on your list of codespaces at https://github.com/codespaces, click the ellipsis (...) to the right of the codespace you want to stop and click Stop codespace.
- In VS Code: open the Visual Studio Code Command Palette - for example, by pressing Ctrl+Shift+Enter(Windows/Linux) or Shift+Command+P (Mac) - type
Codespaces: stop
then press Enter.- In the JetBrains client, click the stop button at the top of the GitHub Codespaces tool window. For more information, see the "JetBrains IDEs" tab of "Stopping and starting a codespace."
- In a terminal window: use the GitHub CLI command
gh codespace stop
. For more information, see "Using GitHub Codespaces with GitHub CLI." If you exit your codespace without running the stop command (for example, by closing the browser tab), or if you leave the codespace running without interaction, the codespace and its running processes will continue for the duration of the inactivity timeout period.When you close or stop your codespace, all uncommitted changes are preserved until you connect to the codespace again.