Skip to main content

Deleting a codespace

You can delete a codespace you no longer need.

Os GitHub Codespaces estão disponíveis para organizações que usam o GitHub Team ou o GitHub Enterprise Cloud. GitHub Codespaces também está disponível como uma versão beta limitado para usuários individuais nos planos GitHub Free e GitHub Pro. Para obter mais informações, confira "produtos de GitHub".

There are costs associated with storing codespaces. You should therefore delete any codespaces you no longer need. For more information, see "About billing for GitHub Codespaces."

Há limites para o número de codespaces que você pode criar e o que você pode executar ao mesmo tempo. Esses limites variam de acordo com uma série de fatores. Se você atingir o número máximo de codespaces e tentar criar outro, uma mensagem será exibida informando que você deverá remover um codespace antes de criar um novo.

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

Você pode excluir codespaces de dentro do VS Code quando você não estiver trabalhando no codespace.

  1. Em VS Code, na barra lateral esquerda, clique no ícone do Gerenciador Remoto.

    O ícone do Remote Explorer no Visual Studio Code

    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.
  2. Em "GITHUB CODESPACES", clique com o botão direito do mouse no codespace que você deseja excluir.

  3. Clique em Excluir Codespace.

    Excluir um codespace em GitHub

Para saber mais sobre a GitHub CLI, confira "Sobre a 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

Deleting codespaces in your organization

As an organization owner, you can use GitHub CLI to delete any codespace in your organization.

For more information, click the "GitHub CLI" tab near the top of this page.

For more information, click the "GitHub CLI" tab near the top of this page.

  1. Enter one of these commands to display a list of codespaces.

    • gh codespace delete --org ORGANIZATION - Lists the current codespaces in the specified organization.
    • gh codespace delete --org ORGANIZATION --user USER - Lists only those codespaces created by the specified user. You must be an owner of the specified organization.
  2. In the list of codespaces, navigate to the codespace you want to delete.

  3. To delete the selected codespace press Enter.

    If the codespace contains unsaved changes you will be prompted to confirm deletion.

You can also use the REST API to delete codespaces for your organization. For more information, see "Codespaces organizations."

Further reading