Skip to main content

Deleting a codespace

You can delete a codespace you no longer need.

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

You can create more than one codespace per repository or even per branch. However, each personal account has a limit of 10 codespaces. If you've reached the limit and want to create a new codespace, you must delete a codespace first.

Note: Only the person who created a codespace can delete it. There is currently no way for organization owners to delete codespaces created within their organization.

Deleting a codespace

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

  2. To the right of the codespace you want to delete, click , then click Delete

    Delete button

You can delete codespaces from within VS Code when you are not currently working in a codespace.

  1. In VS Code, in the left sidebar, click the Remote Explorer icon. The Remote Explorer icon in Visual Studio Code

  2. Under "GITHUB CODESPACES", right-click the codespace you want to delete.

  3. Click Delete Codespace.

    Deleting a codespace in GitHub

To learn more about GitHub CLI, see "About GitHub CLI."

To delete a codespace use the gh codespace delete subcommand and then choose a codespace from the list that's displayed.

gh codespace delete

If you have unsaved changes, you'll be prompted to confirm deletion. You can use the --force flag to force deletion, avoiding this prompt.

For more information about this command, see the GitHub CLI manual.

Bulk deleting codespaces

You can use GitHub CLI to delete several or all of your codespaces with a single command. For more information, click the GitHub CLI tab near the top of this page.

You can use GitHub CLI to delete several or all of your codespaces with a single command. For more information, click the GitHub CLI tab near the top of this page.

You can delete several or all of your codespaces with a single command, using gh codespace delete followed by one of these flags:

--all - Delete all of your codespaces.

--repo REPOSITORY - Delete all of your codespaces for this repository. Or use together with the --days flag to filter by age of the codespace.

--days NUMBER - Delete all of your codespaces that are older than the specified number of days. Can be used together with the --repo flag.

By default you are prompted to confirm deletion of any codespaces that contain unsaved changes. You can use the --force flag to skip this confirmation.

Example

Delete all of the codespaces for the octo-org/octo-repo repository that you created more than 7 days ago.

gh cs delete --repo octo-org/octo-repo --days 7

Further reading