About GitHub Codespaces in Visual Studio Code
You can use your local install of Visual Studio Code to create, manage, work in, and delete codespaces. To use GitHub Codespaces in VS Code, you need to install the Codespaces extension. For more information on setting up GitHub Codespaces in VS Code, see Prerequisites.
By default, if you create a new codespace on GitHub, 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 GitHub Codespaces for your account.
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.
-
In VS Code, in the Activity Bar, click the Remote Explorer icon.

Note
If the Remote Explorer is not displayed in the Activity Bar:
- Access the Command Palette. For example, by pressing Shift+Command+P (Mac) / Ctrl+Shift+P (Windows/Linux).
- Type:
details. - Click Codespaces: Details.
-
Select "GitHub Codespaces" from the dropdown at the top of the "Remote Explorer" side bar, if it is not already selected.
-
Click Sign in to GitHub.

-
If you are not currently signed in to GitHub you'll be prompted to do so. Go ahead and sign in.
-
When you're prompted to specify what you want to authorize, click the Authorize button for "GitHub."
-
If the authorization page is displayed, click Authorize Visual-Studio-Code.
Connecting to an enterprise on GHE.com
If you access GitHub through a subdomain of GHE.com, you must configure the Github-enterprise: Uri and Github > Codespaces: Auth Provider settings in VS Code before you can connect to your codespaces.
-
To open your VS Code settings, press Command+, (Mac) or Ctrl+, (Windows).
-
In the search bar, search for
enterprise. -
For the
Github-enterprise: Urisetting, enter the URL where you access GitHub. For example:https://octocorp.ghe.com.Alternatively, you can add the following to your
settings.jsonfile:JSON "github-enterprise.uri": "https://SUBDOMAIN.ghe.com"
"github-enterprise.uri": "https://SUBDOMAIN.ghe.com" -
In the VS Code settings, search for
Codespaces Auth Provider. -
For the
Github > Codespaces: Auth Providersetting, selectgithub-enterprisefrom the dropdown.Alternatively, you can add the following to your
settings.jsonfile:JSON "github.codespaces.authProvider": "github-enterprise"
"github.codespaces.authProvider": "github-enterprise" -
You will be shown a prompt asking you to sign in. Click Sign in to GitHub, then follow the prompts to authorize your account.
If you don't see the prompt, try restarting VS Code.
If you ever need to switch back to an account on GitHub.com, set the Github > Codespaces: Auth Provider setting back to its default value and remove the Github-enterprise: Uri setting.
Creating a codespace in VS Code
After you connect your account on GitHub to the GitHub Codespaces extension, you can create a new codespace. For more information about the GitHub Codespaces extension, see the VS Code Marketplace.
-
In VS Code, in the Activity Bar, click the Remote Explorer icon.

Note
If the Remote Explorer is not displayed in the Activity Bar:
- Access the Command Palette. For example, by pressing Shift+Command+P (Mac) / Ctrl+Shift+P (Windows/Linux).
- Type:
details. - Click Codespaces: Details.
-
Hover over the "Remote Explorer" side bar and click .

-
In the text box, type the name of the repository you want to develop in, then select it.

A message is displayed at the right side of subsequent prompts telling you who will pay for the codespace.

-
Click the branch you want to develop on.