Skip to main content

Deleting a codespace

You can delete a codespace you no longer need.

GitHub Codespaces は、GitHub Team または GitHub Enterprise Cloud を使用する Organization で利用できます。 GitHub Free および GitHub Pro プランの個人ユーザーも、GitHub Codespaces を制限付きのベータ リリースとして利用できます。 詳細については、「GitHub's products」を参照してください。

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."

作成できる codespace の数と、同時に実行できる codespace の数には制限があります。 これらの制限は、いくつかの要因によって異なります。 codespace の最大数に達してからさらに作成しようとすると、新しい codespace を作成する前に既存のものを削除する必要があることを示すメッセージが表示されます。

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

現在 codespace で作業していない場合、VS Code 内から codespace を削除できます。

  1. VS Code の左サイドバーで、[リモート エクスプローラー] のアイコンをクリックします。

    Visual Studio Code のリモート エクスプローラー アイコン

    : リモート エクスプローラーがアクティビティ バーに表示されない場合:

    1. コマンド パレットにアクセスします。 たとえば、Shift + Command + P (Mac) / Ctrl + Shift + P (Windows/Linux) を押します。
    2. 次のコマンドを入力します: codespaces
    3. [コードスペース: 詳細] をクリックします。
  2. [GITHUB CODESPACE] で、削除する codespace を右クリックします。

  3. [Codespace の削除] をクリックします。

    GitHub で Codespaces を削除する

GitHub CLI の詳細については、「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