Codespaces: Document listing/deleting codespaces for organizations (#30525)
Co-authored-by: Jules <19994093+jules-p@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,8 @@ redirect_from:
|
||||
Organization owners and billing managers can view {% data variables.product.prodname_github_codespaces %} usage for an organization. For organizations managed by an enterprise account, the organization owners can view {% data variables.product.prodname_codespaces %} usage in the organization billing page, and enterprise admins can view the usage for the entire enterprise.
|
||||
|
||||
{% data reusables.organizations.billing-settings %}
|
||||
{% data reusables.dotcom_billing.codespaces-minutes %}
|
||||
1. Under "{% data variables.product.prodname_codespaces %}", view the details of the compute hours and storage used so far this month.
|
||||

|
||||
{% data reusables.dotcom_billing.actions-packages-report-download-org-account %}
|
||||
1. Filter the report to show only rows that mention "Codespaces" in the `Product` field.
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ The lifecycle of a codespace begins when you create a codespace and ends when yo
|
||||
|
||||
## Creating a codespace
|
||||
|
||||
When you want to work on a project, you can choose to create a new codespace or open an existing codespace. You might want to create a new codespace from a branch of your project each time you develop in {% data variables.product.prodname_codespaces %} or keep a long-running codespace for a feature.
|
||||
When you want to work on a project, you can choose to create a new codespace or open an existing codespace. You might want to create a new codespace from a branch of your project each time you develop in {% data variables.product.prodname_codespaces %} or keep a long-running codespace for a feature. For more information, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace)."
|
||||
|
||||
If you choose to create a new codespace each time you work on a project, you should regularly push your changes so that any new commits are on {% data variables.product.prodname_dotcom %}. You can have up to 10 codespaces at a time. Once you have 10 codespaces, you must delete a codespace before you can create a new one. For more information, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace)."
|
||||
If you choose to create a new codespace each time you work on a project, you should regularly push your changes so that any new commits are on {% data variables.product.prodname_dotcom %}. {% data reusables.codespaces.max-number-codespaces %} For more information, see "[Deleting a codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)."
|
||||
|
||||
If you choose to use a long-running codespace for your project, you should pull from your repository's default branch each time you start working in your codespace so that your environment has the latest commits. This workflow is very similar to if you were working with a project on your local machine.
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ shortTitle: Create a codespace
|
||||
|
||||
You can create a codespace on {% data variables.product.prodname_dotcom_the_website %}, in {% data variables.product.prodname_vscode %}, or by using {% data variables.product.prodname_cli %}. {% data reusables.codespaces.codespaces-are-personal %}
|
||||
|
||||
Codespaces are associated with a specific branch of a repository and the repository cannot be empty. {% data reusables.codespaces.concurrent-codespace-limit %}
|
||||
|
||||
Codespaces are associated with a specific branch of a repository and the repository cannot be empty. You can create more than one codespace per repository or even per branch.
|
||||
|
||||
When you create a codespace, a number of steps happen to create and connect you to your development environment:
|
||||
|
||||
|
||||
@@ -16,15 +16,9 @@ topics:
|
||||
shortTitle: Delete a codespace
|
||||
---
|
||||
|
||||
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](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
|
||||
|
||||
|
||||
{% data reusables.codespaces.concurrent-codespace-limit %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**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.
|
||||
|
||||
{% endnote %}
|
||||
{% data reusables.codespaces.max-number-codespaces %}
|
||||
|
||||
## Deleting a codespace
|
||||
|
||||
@@ -98,5 +92,36 @@ gh cs delete --repo octo-org/octo-repo --days 7
|
||||
|
||||
{% endcli %}
|
||||
|
||||
## Deleting codespaces in your organization
|
||||
|
||||
As an organization owner, you can use {% data variables.product.prodname_cli %} to delete any codespace in your organization.
|
||||
|
||||
{% webui %}
|
||||
|
||||
For more information, click the "{% data variables.product.prodname_cli %}" tab near the top of this page.
|
||||
|
||||
{% endwebui %}
|
||||
|
||||
{% vscode %}
|
||||
|
||||
For more information, click the "{% data variables.product.prodname_cli %}" tab near the top of this page.
|
||||
|
||||
{% endvscode %}
|
||||
|
||||
{% cli %}
|
||||
|
||||
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.
|
||||
1. In the list of codespaces, navigate to the codespace you want to delete.
|
||||
1. To delete the selected codespace press <kbd>Enter</kbd>.
|
||||
|
||||
If the codespace contains unsaved changes you will be prompted to confirm deletion.
|
||||
|
||||
{% endcli %}
|
||||
|
||||
You can also use the REST API to delete codespaces for your organization. For more information, see "[Codespaces organizations](/rest/codespaces/organizations#delete-a-codespace-from-the-organization)."
|
||||
|
||||
## Further reading
|
||||
- "[Codespaces lifecycle](/codespaces/developing-in-codespaces/codespaces-lifecycle)"
|
||||
@@ -10,6 +10,7 @@ topics:
|
||||
- Codespaces
|
||||
children:
|
||||
- /enabling-github-codespaces-for-your-organization
|
||||
- /listing-the-codespaces-in-your-organization
|
||||
- /managing-billing-for-github-codespaces-in-your-organization
|
||||
- /managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces
|
||||
- /managing-repository-access-for-your-organizations-codespaces
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: Listing the codespaces in your organization
|
||||
shortTitle: List organization codespaces
|
||||
intro: 'You can list all of the currently active or stopped codespaces for your organization.'
|
||||
product: '{% data reusables.gated-features.codespaces %}'
|
||||
permissions: 'To list all of the current codespaces for your organization, you must be an organization owner.'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
topics:
|
||||
- Codespaces
|
||||
- Administrator
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
As an organization owner, you can list all of the currently active and stopped codespaces for your organization. You might want to do this to check how many codespaces users are creating, to make sure they aren't incurring unnecessary costs.
|
||||
|
||||
The easiest way to list the codespaces for an organization is by using {% data variables.product.prodname_cli %}. You can also use the REST API, which provides more information about each codespace.
|
||||
|
||||
### Using {% data variables.product.prodname_cli %} to list codespaces
|
||||
|
||||
To list all of the current codespaces for a specified organization, use the following command.
|
||||
|
||||
```shell{:copy}
|
||||
gh codespace list --org ORGANIZATION
|
||||
```
|
||||
|
||||
This command returns a list that includes the following information for each codespace:
|
||||
- The name and display name
|
||||
- The user who created the codespace
|
||||
- The repository and branch
|
||||
- The current state of the codespace
|
||||
|
||||
To list all of the current codespaces for an organization that were created by a specific user, use the following command.
|
||||
|
||||
```shell{:copy}
|
||||
gh codespace list --org ORGANIZATION --user USER
|
||||
```
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note**: In the above commands, replace `ORGANIZATION` with the name of the organization you are querying. You must be an owner of the organization.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
### Using the REST API to list codespaces
|
||||
|
||||
You can use the `/orgs/{org}/codespaces` API endpoint as an alternative method of listing the current codespaces for an organization. This returns more information than {% data variables.product.prodname_cli %}; for example, the machine type details.
|
||||
|
||||
For more information about this endpoint, see "[Codespaces organizations](/rest/codespaces/organizations#list-codespaces-for-the-organization)."
|
||||
@@ -21,8 +21,8 @@ To learn about pricing for {% data variables.product.prodname_github_codespaces
|
||||
|
||||
{% data reusables.codespaces.codespaces-billing %}
|
||||
|
||||
- As an organization owner or a billing manager you can manage {% data variables.product.prodname_codespaces %} billing for your organization: ["About billing for Codespaces"](/billing/managing-billing-for-github-codespaces/about-billing-for-codespaces)
|
||||
|
||||
- As an organization owner or a billing manager, you can manage {% data variables.product.prodname_codespaces %} billing for your organization: ["About billing for Codespaces"](/billing/managing-billing-for-github-codespaces/about-billing-for-codespaces)
|
||||
- As an organization owner, you can list the currently active and stopped codespaces for your organization. In addition to these codespaces, costs for the current month may include costs for codespaces that existed earlier in the current month but have since been deleted.
|
||||
- For users, there is a guide that explains how billing works: ["Understanding billing for Codespaces"](/codespaces/codespaces-reference/understanding-billing-for-codespaces)
|
||||
|
||||
## Usage limits
|
||||
@@ -31,7 +31,7 @@ You can set a usage limit for the codespaces in your organization or repository.
|
||||
|
||||
- **Compute minutes:** Compute usage is calculated by the actual number of minutes used by all {% data variables.product.prodname_codespaces %} instances while they are active. These totals are reported to the billing service daily, and is billed monthly. You can set a spending limit for {% data variables.product.prodname_codespaces %} usage in your organization. For more information, see "[Managing spending limits for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-github-codespaces)."
|
||||
|
||||
- **Storage usage:** For {% data variables.product.prodname_codespaces %} billing purposes, this includes all storage used by all codespaces in your account. This includes all used by the codespaces, such as cloned repositories, configuration files, and extensions, among others. These totals are reported to the billing service daily, and is billed monthly. At the end of the month, {% data variables.product.prodname_dotcom %} rounds your storage to the nearest MB. To check how many compute minutes and storage GB have been used by {% data variables.product.prodname_codespaces %}, see "[Viewing your {% data variables.product.prodname_github_codespaces %} usage"](/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage)."
|
||||
- **Storage usage:** For {% data variables.product.prodname_codespaces %} billing purposes, this includes all storage used by all codespaces in your account. This includes resources such as cloned repositories, configuration files, and extensions, among others. These totals are reported to the billing service daily, and is billed monthly. At the end of the month, {% data variables.product.prodname_dotcom %} rounds your storage to the nearest MB. To check how many compute minutes and storage GB have been used by {% data variables.product.prodname_codespaces %}, see "[Viewing your {% data variables.product.prodname_github_codespaces %} usage"](/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage)."
|
||||
|
||||
## Disabling or limiting {% data variables.product.prodname_codespaces %}
|
||||
|
||||
@@ -47,10 +47,16 @@ You can also restrict how long a codespace can remain unused before it is automa
|
||||
|
||||
## Deleting unused codespaces
|
||||
|
||||
Your users can delete their codespaces in https://github.com/codespaces and from within {% data variables.product.prodname_vscode %}. To reduce the size of a codespace, users can manually delete files using the terminal or from within {% data variables.product.prodname_vscode_shortname %}.
|
||||
Your users can delete their own codespaces in https://github.com/codespaces and from within {% data variables.product.prodname_vscode %}. To reduce the size of a codespace, users can manually delete files using the terminal or from within {% data variables.product.prodname_vscode_shortname %}.
|
||||
|
||||
As an organization owner, you can delete any codespace in your organization. For more information, see "[Deleting a codespace](/codespaces/developing-in-codespaces/deleting-a-codespace#deleting-codespaces-in-your-organization)."
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** Codespaces are automatically deleted after they have been stopped and have remained inactive for a defined number of days. For more information, see "[Restricting the retention period for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)." A codespace can only be manually deleted by the person who created the codespace.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
## Further reading
|
||||
|
||||
- "[Listing the codespaces in your organization](/codespaces/managing-codespaces-for-your-organization/listing-the-codespaces-in-your-organization)"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
You can create more than one codespace per repository or even per branch.
|
||||
1
data/reusables/codespaces/max-number-codespaces.md
Normal file
1
data/reusables/codespaces/max-number-codespaces.md
Normal file
@@ -0,0 +1 @@
|
||||
You can have up to 10 codespaces at a time. Once you have 10 codespaces, you must delete a codespace before you can create a new one.
|
||||
@@ -1,2 +0,0 @@
|
||||
1. Under "{% data variables.product.prodname_codespaces %}", view usage details of your compute hours and storage.
|
||||

|
||||
Reference in New Issue
Block a user