Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Changing the machine type for your codespace
shortTitle: Change the machine type
intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for work you''re doing.'
intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for the work you''re doing.'
product: '{% data reusables.gated-features.codespaces %}'
versions:
fpt: '*'
Expand All @@ -23,9 +23,17 @@ type: how_to

{% data reusables.codespaces.codespaces-machine-types %} You can choose an alternative machine type either when you create a codespace or at any time after you've created a codespace.

For information on choosing a machine type when you create a codespace, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace)." For information on changing the machine type within {% data variables.product.prodname_vscode %}, see "[Using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code#changing-the-machine-type-in-visual-studio-code)."
For information on choosing a machine type when you create a codespace, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace)."

## Changing the machine type in {% data variables.product.prodname_dotcom %}
## Changing the machine type

{% note %}

**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}

{% endnote %}

{% webui %}

{% data reusables.codespaces.your-codespaces-procedure-step %}

Expand All @@ -37,33 +45,64 @@ For information on choosing a machine type when you create a codespace, see "[Cr
1. Click **Change machine type**.

!['Change machine type' menu option](/assets/images/help/codespaces/change-machine-type-menu-option.png)

1. If multiple machine types are available for your codespace, choose the type of machine you want to use.

![Dialog box showing available machine types to choose](/assets/images/help/codespaces/change-machine-type-choice.png)
1. Click **Update codespace**.

{% endwebui %}

{% vscode %}

{% data reusables.codespaces.changing-machine-type-in-vscode %}

{% endvscode %}

{% cli %}

You can use the `gh codespace edit --machine MACHINE-TYPE-NAME` {% data variables.product.prodname_cli %} command to change the machine type of a codespace. To use this command, you'll first need to find out the available machine types for your codespace.

{% note %}
1. To view your list of codespaces, in a terminal, enter the following command.

```
gh codespace list
```
1. Optionally, to find the current machine type for a codespace, enter the following command.

```
gh api /user/codespaces/CODESPACE-NAME
```

**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-myrepo-gmc7`. The permanent names are listed under the **NAME** column in the list returned by `gh codespace list`.

{% endnote %}
If you're prompted to request the `codespace` scope, follow the instructions in the terminal.

2. Click **Update codespace**.
Details for the current machine are listed under the `machine` field.
1. To find the available machine types for a codespace, enter the following command.

```
gh api /user/codespaces/CODESPACE-NAME/machines
```

The change will take effect the next time your codespace restarts.
Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-myrepo-gmc7`.
1. To change the machine type for a codespace, enter the following command.

## Force an immediate update of a currently running codespace
```
gh codespace edit --machine MACHINE-TYPE-NAME
```

If you change the machine type of a codespace you are currently using, and you want to apply the changes immediately, you can force the codespace to restart.
Replace `MACHINE-TYPE-NAME` with the name of an available machine type for your codespace, for example `standardLinux32gb`.
1. Using the arrow keys, navigate to the codespace you want to change, then press <kbd>Enter</kbd>.

1. At the bottom left of your codespace window, click **{% data variables.product.prodname_codespaces %}**.
{% endcli %}

![Click '{% data variables.product.prodname_codespaces %}'](/assets/images/help/codespaces/codespaces-button.png)
{% data reusables.codespaces.about-changing-storage-size %}

1. From the options that are displayed at the top of the page select **Codespaces: Stop Current Codespace**.
{% cli %}

!['Suspend Current Codespace' option](/assets/images/help/codespaces/suspend-current-codespace.png)
## Further reading

1. After the codespace is stopped, click **Restart codespace**.
- "[Codespaces machines](/rest/codespaces/machines)" in the REST API documentation
- [`gh codespace edit`](https://cli.github.com/manual/gh_codespace_edit) in the {% data variables.product.prodname_cli %} manual

![Click 'Resume'](/assets/images/help/codespaces/resume-codespace.png)
{% endcli %}
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,15 @@ Use the {% data variables.product.prodname_vscode_marketplace %} to install the

{% data reusables.codespaces.codespaces-machine-types %} You can change the machine type of your codespace at any time.

1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette (`shift command P` / `shift control P`).
1. Search for and select "Codespaces: Change Machine Type."
{% note %}

![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-type-option.png)
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}

1. Click the codespace that you want to change.
{% endnote %}

![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-choose-repo.png)
{% data reusables.codespaces.changing-machine-type-in-vscode %}

1. Choose the machine type you want to use.

{% note %}

**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}

{% endnote %}

1. If the codespace is currently running, a message is displayed asking if you would like to restart and reconnect to your codespace now.

Click **Yes** if you want to change the machine type used for this codespace immediately.

If you click **No**, or if the codespace is not currently running, the change will take effect the next time the codespace restarts.
{% data reusables.codespaces.about-changing-storage-size %}

## Deleting a codespace in {% data variables.product.prodname_vscode_shortname %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ You can work with {% data variables.product.prodname_github_codespaces %} in the
- [Modify ports in a codespace](#modify-ports-in-a-codespace)
- [Access codespace logs](#access-codespace-logs)
- [Access remote resources](#access-remote-resources)
- [Change the machine type of a codespace](#change-the-machine-type-of-a-codespace)

## Installing {% data variables.product.prodname_cli %}

Expand Down Expand Up @@ -206,4 +207,12 @@ You can use the {% data variables.product.prodname_cli %} extension to create a

**Note**: The {% data variables.product.prodname_cli %} extension is currently in beta and subject to change.

{% endnote %}
{% endnote %}

### Change the machine type of a codespace

```shell
gh codespace edit -m <em>machine-type-name</em>
```

For more information, see the "{% data variables.product.prodname_cli %}" tab of "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace)."
3 changes: 3 additions & 0 deletions data/reusables/codespaces/about-changing-storage-size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
If you changed to a virtual machine with a different storage capacity (for example, from 64GB to 32GB), your codespace will be unavailable for a short time while the machine type is changed. If the codespace is currently active, it will automatically be stopped. When the change is complete, you'll be able to restart the codespace running on the new machine type.

If you changed to a virtual machine with the same storage capacity, the change will be applied the next time you restart the codespace. An active codespace will not be stopped automatically. For more information on restarting a codespace, see "[Stopping and starting a codespace](/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace#restarting-a-codespace)."
11 changes: 11 additions & 0 deletions data/reusables/codespaces/changing-machine-type-in-vscode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette with <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux).
1. Search for and select "Codespaces: Change Machine Type."

![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-type-option.png)
1. If you're not following these instructions within a codespace, click the codespace that you want to change.

![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-choose-repo.png)

If you are following these instructions in a codespace, the change will apply to the codespace you're working in.
1. Select the machine type you want to use.
1. If you're changing to a machine type with a different storage capacity, a prompt will appear asking if you would like to continue. Read the prompt and click **Yes** to accept.