Using GitHub Codespaces in Visual Studio Code - GitHub Docs
Using GitHub Codespaces in Visual Studio Code - GitHub Docs
In this article
By default, if you create a new codespace on GitHub.com, it will open in the browser. If you would
prefer to open any new codespaces in VS Code automatically, you can set your default editor to be
VS Code. For more information, see "Setting your default editor for GitHub Codespaces."
If you prefer to work in the browser, but want to continue using your existing VS Code extensions,
themes, and shortcuts, you can turn on Settings Sync. For more information, see "Personalizing
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 1/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
Prerequisites
To develop in a codespace directly in VS Code, you must install and sign into the GitHub
Codespaces extension with your GitHub credentials. The GitHub Codespaces extension requires VS
Code October 2020 Release 1.51 or later.
Use the Visual Studio Code Marketplace to install the GitHub Codespaces extension. For more
information, see Extension Marketplace in the VS Code documentation.
a. Access the Command Palette. For example, by pressing Shift + Command + P (Mac) /
Ctrl + Shift + P (Windows/Linux).
b. Type: details .
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 2/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
2 Select "GitHub Codespaces" from the dropdown at the top of the "Remote Explorer" side bar,
if it is not already selected.
4 If you are not currently signed in to GitHub you'll be prompted to do so. Go ahead and sign in.
5 When you're prompted to specify what you want to authorize, click the Authorize button for
"GitHub."
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 3/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
a. Access the Command Palette. For example, by pressing Shift + Command + P (Mac) /
Ctrl + Shift + P (Windows/Linux).
b. Type: details .
3 In the text box, type the name of the repository you want to develop in, then select it.
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 4/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
A message is displayed at the right side of subsequent prompts telling you who will pay for
the codespace.
5 If prompted to choose a dev container configuration file, choose a file from the list.
Note: Your choice of available machine types may be limited by a number of factors.
These can include a policy configured for your organization, or a minimum machine type
specification for your repository. For more information, see "Restricting access to machine
types" and "Setting a minimum specification for codespace machines."
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 5/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
a. Access the Command Palette. For example, by pressing Shift + Command + P (Mac) /
Ctrl + Shift + P (Windows/Linux).
b. Type: details .
2 Under "GitHub Codespaces", hover over the codespace you want to develop in.
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 6/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
By default the machine type with the lowest valid resources is used when you create a codespace.
You can change the machine type of your codespace at any time.
Note: Your choice of available machine types may be limited by a number of factors. These can
include a policy configured for your organization, or a minimum machine type specification for
your repository. For more information, see "Restricting access to machine types" and "Setting a
minimum specification for codespace machines."
1 In VS Code, open the Command Palette with Command + Shift + P (Mac) or Ctrl + Shift + P
(Windows/Linux).
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 7/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
3 If you're not following these instructions within a codespace, click the codespace that you want
to change.
If you are following these instructions in a codespace, the change will apply to the codespace
you're working in.
5 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.
If you changed to a virtual machine with a different storage capacity (for example, from 32 GB to 64
GB), 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."
You can delete codespaces from within VS Code when you are not currently working in a codespace.
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 8/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
a. Access the Command Palette. For example, by pressing Shift + Command + P (Mac) /
Ctrl + Shift + P (Windows/Linux).
b. Type: details .
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 9/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
After you switch versions in a codespace, the web client will continue to use the Insiders version if
you stop and restart the codespace. New codespaces that you create and open in the VS Code web
client will also use the Insiders version.
3 Click Reload.
To switch back to the Stable version of VS Code, repeat the process but choose Switch to Stable
Version. After you switch back, the codespace will continue to use the Stable version if you stop and
restart the codespace. New codespaces that you create and open in the VS Code web client will also
use the Stable version.
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 10/11
2/18/24, 9:34 PM Using GitHub Codespaces in Visual Studio Code - GitHub Docs
Further reading
"Using the Visual Studio Code Command Palette in GitHub Codespaces"
"Using GitHub Copilot in GitHub Codespaces"
Legal
© 2024 GitHub, Inc. Terms Privacy Status Pricing Expert services Blog
https://docs.github.com/en/codespaces/developing-in-a-codespace/using-github-codespaces-in-visual-studio-code 11/11