Skip to main content

Changing the machine type for your codespace

You can change the type of machine that's running your codespace, so that you're using resources appropriate for work you're doing.

GitHub Codespaces 可用于使用 GitHub Team 或 GitHub Enterprise Cloud 的组织。 更多信息请参阅“GitHub 的产品”。

About machine types

Note: You can only select or change the machine type if you are a member of an organization using GitHub Codespaces and are creating a codespace on a repository owned by that organization.

通常,您可以在选择的远程机器上运行代码空间,从 2 核到 32 核。 每种类型都有不同的资源水平和不同的计费等级。 有关信息请参阅“关于 GitHub Codespaces 的计费”。

默认情况下,在创建代码空间时,将使用具有最低有效资源的计算机类型。 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." For information on changing the machine type within Visual Studio Code, see "Using Codespaces in Visual Studio Code."

Changing the machine type in GitHub

  1. 在 的右上角,单击您的头像,然后单击 Your codespaces(您的代码空间)


    The current machine type for each of your codespaces is displayed.

    'Your codespaces' list

  2. Click the ellipsis (...) to the right of the codespace you want to modify.

  3. Click Change machine type.

    'Change machine type' menu option

  4. 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

    Note: 您对可用计算机类型的选择可能受到为组织配置的策略或存储库的最低计算机类型规范的限制。 更多信息请参阅“限制对计算机类型的访问”和“为代码空间计算机设置最小规范”。

  5. Click Update codespace.

    The change will take effect the next time your codespace restarts.

Force an immediate update of a currently running codespace

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.

  1. At the bottom left of your codespace window, click Codespaces.

    Click 'Codespaces'

  2. From the options that are displayed at the top of the page select Codespaces: Stop Current Codespace.

    'Suspend Current Codespace' option

  3. After the codespace is stopped, click Restart codespace.

    Click 'Resume'