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
-
Navigate to the "Your Codespaces" page at github.com/codespaces.
-
To the right of the codespace you want to delete, click , then click Delete
You can delete codespaces from within VS Code when you are not currently working in a codespace.
-
In VS Code, in the left sidebar, click the Remote Explorer icon.
-
Under "GITHUB CODESPACES", right-click the codespace you want to delete.
-
Click Delete Codespace.
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