Skip to main content

Opening an existing codespace

You can reopen a codespace that you have closed or stopped and return to your work.

Note: Using GitHub Codespaces with JetBrains IDEs is currently in public beta and is subject to change.

You can reopen any of your active or stopped codespaces on GitHub.com, in a JetBrains IDE, in Visual Studio Code, or by using GitHub CLI. You can't reopen a codespace that has been deleted. For more information, see "The codespace lifecycle."

You can view all your codespaces on the "Your codespaces" page at github.com/codespaces. From this page, you can:

Opening an existing codespace

  1. Navigate to the "Your codespaces" page at github.com/codespaces.

  2. To open a codespace in your default editor, click the name of the codespace. You can set your default editor for Codespaces in your personal settings page. For more information, see "Setting your default editor for GitHub Codespaces."

    To open the codespace in an editor other than your default:

    1. Click the ellipsis (...) to the right of the codespace you want to open.
    2. Click Open in.
    3. Click Open in APPLICATION.

    Screenshot of the "Open in" dialog box, with "Open in Visual Studio Code" highlighted

    You can open the codespace in:

    • Your browser
    • Visual Studio Code
    • JetBrains Gateway
    • JupyterLab

    If you choose Visual Studio Code or JetBrains Gateway, you must make sure you have installed the selected application on your local machine.

    If you choose JupyterLab, the JupyterLab application must be installed in the codespace. The default container image includes JupyterLab, so codespaces created from the default image will always have JupyterLab installed. For more information about the default image, see "Introduction to dev containers" and the devcontainers/images repository. If you're not using the default image in your dev container configuration, you can install JupyterLab by adding the ghcr.io/devcontainers/features/python feature to your devcontainer.json file. You should include the option "installJupyterlab": true. For more information, see the README for the python feature, in the devcontainers/features repository.

Note: To use GitHub Codespaces in VS Code, you need to install the Codespaces extension. For more information, see "Using GitHub Codespaces in Visual Studio Code."

  1. In the VS Code desktop application, open the Command Palette with Command+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux).

  2. Type "Codespaces" and select one of the following commands.

    • To open a codespace in a new window of VS Code, select Codespaces: Open Codespace in New Window
    • To open a codespace in the web editor, select Codespaces: Open in Browser
  3. Click the codespace that you want to open.

    Screenshot of a list of codespaces in Visual Studio Code

You can also access the commands listed above by navigating to the Remote Explorer view in VS Code and right-clicking the codespace that you want to open.

Screenshot of a codespace selected in the Remote Explorer, with "Open in Browser" highlighted

Note: If the Remote Explorer is not displayed in the Activity Bar:

  1. Access the Command Palette. For example, by pressing Shift+Command+P (Mac) / Ctrl+Shift+P (Windows/Linux).
  2. Type: codespaces.
  3. Click Codespaces: Details.
  1. In a terminal, enter one of the following GitHub CLI commands.

    • To open a codespace in VS Code, enter:

      Shell
      gh codespace code

      Note: You must have VS Code installed on your local machine. For more information, see "Setting up Visual Studio Code" in the VS Code documentation.

    • To open a codespace in the browser, enter:

      Shell
      gh codespace code --web
    • To open a codespace in JupyterLab, enter:

      Shell
      gh codespace code --jupyter

      Note: The JupyterLab application must be installed in the codespace you are opening. The default container image includes JupyterLab, so codespaces created from the default image will always have JupyterLab installed. For more information about the default image, see "Introduction to dev containers" and the devcontainers/images repository. If you're not using the default image in your dev container configuration, you can install JupyterLab by adding the ghcr.io/devcontainers/features/python feature to your devcontainer.json file. You should include the option "installJupyterlab": true. For more information, see the README for the python feature, in the devcontainers/features repository.

  2. Using the arrow keys, navigate to the codespace that you want to open.

  3. To open the codespace, press Enter.

For more information, see gh codespace code in the GitHub CLI manual.

If you have set the JetBrains Gateway as your default editor, then the Gateway will launch automatically when you open a codespace from GitHub.com.

If the JetBrains Gateway is not your default editor, you can still open a codespace in JetBrains by going to the "Your codespaces" page at github.com/codespaces and clicking the ellipsis (...) to the right of the codespace you want to open. For more information, see "Opening an existing codespace."

Alternatively, you can also open the JetBrains Gateway and select an existing codespace, as described in the following procedure.

  1. Open the JetBrains Gateway application.

  2. Click Connect to Codespaces.

    Screenshot of the JetBrains Gateway initial view

  3. In the "Your Codespaces" list, click the codespace you want to work in.

    Screenshot of the JetBrains Gateway codespace list

  4. In the "Available IDEs" list, click the JetBrains IDE you want to use. The Gateway will remember your choice the next time you connect to a codespace.

    Screenshot of the JetBrains Gateway codespace list

  5. Click Connect.

    Note: If you are running a firewall: the first time you connect to a remote resource, you may be prompted to allow the JetBrains Gateway to communicate across your network.