Using Codespaces in Visual Studio Code

You can develop in your codespace directly in Visual Studio Code by connecting the GitHub Codespaces extension with your account on GitHub.

Codespaces is available for organizations using GitHub Team or GitHub Enterprise Cloud. For more information, see "GitHub's products."

Prerequisites

To develop in a codespace directly in Visual Studio Code, you must sign into the GitHub Codespaces extension. The GitHub Codespaces extension requires Visual Studio Code October 2020 Release 1.51 or later.

Use the Visual Studio Marketplace to install the GitHub Codespaces extension. For more information, see Extension Marketplace in the Visual Studio Code documentation.

  1. In Visual Studio Code, in the left sidebar, click the Remote Explorer icon. The Remote Explorer icon in Visual Studio Code
  2. Click Sign in to view GitHub.... Signing in to view Codespaces
  3. To authorize Visual Studio Code to access your account on GitHub, click Allow.
  4. Sign in to GitHub to approve the extension.
  1. In Visual Studio Code, in the left sidebar, click the Remote Explorer icon. The Remote Explorer icon in Visual Studio Code
  2. Use the "REMOTE EXPLORER" drop-down, then click GitHub Codespaces. The Codespaces header
  3. Click Sign in to view Codespaces.... Signing in to view Codespaces
  4. To authorize Visual Studio Code to access your account on GitHub, click Allow.
  5. Sign in to GitHub to approve the extension.

Creating a codespace in Visual Studio Code

After you connect your GitHub account to the GitHub Codespaces extension, you can develop in a codespace that you created on GitHub or in Visual Studio Code.

  1. In Visual Studio Code, in the left sidebar, click the Remote Explorer icon. The Remote Explorer icon in Visual Studio Code
  2. Click the Add icon, then click Create New Codespace. The Create new Codespace option in Codespaces
  3. Type, then click the repository's name you want to develop in. Searching for repository to create a new Codespaces
  4. Click the branch you want to develop on. Searching for a branch to create a new Codespaces
  5. Click the machine type you want to develop in. Instance types for a new Codespaces

Opening a codespace in Visual Studio Code

  1. In Visual Studio Code, in the left sidebar, click the Remote Explorer icon. The Remote Explorer icon in Visual Studio Code
  2. Under "Codespaces", click the codespace you want to develop in.
  3. Click the Connect to Codespace icon. The Connect to Codespace icon in Visual Studio Code

Changing the machine type in Visual Studio Code

You can run your codespace on a choice of remote machine, from 2 cores to 32 cores. Each of these has a different level of resources and a different billing tier. For information, see "About billing for Codespaces."

You can change the machine type of your codespace at any time.

  1. In Visual Studio Code, open the Command Palette (shift command P / shift control P).
  2. Search for and select "Codespaces: Change Machine Type." Searching for a branch to create a new Codespaces
  3. Click the codespace that you want to change. Searching for a branch to create a new Codespaces
  4. Choose the machine type you want to use.

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.

Deleting a codespace in Visual Studio Code

  1. Under "Codespaces", right-click the codespace you want to delete.
  2. In the drop-down menu, click Delete Codespace. Deleting a codespace in GitHub

Did this doc help you?Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Or, learn how to contribute.