1
0
mirror of synced 2025-12-21 19:06:49 -05:00

Multiple devcontainer.json files & advanced codespace creation options (GA) (#26708)

This commit is contained in:
hubwriter
2022-04-13 20:43:59 +01:00
committed by GitHub
parent e2136f5315
commit b4d40af7ca
53 changed files with 615 additions and 455 deletions

View File

@@ -72,19 +72,53 @@ If you would like to create a codespace for a repository owned by your personal
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
2. Under the repository name, use the "Branch" drop-down menu, and select the branch you want to create a codespace for.
1. Under the repository name, use the "Branch" drop-down menu, and select the branch you want to create a codespace for.
![Branch drop-down menu](/assets/images/help/codespaces/branch-drop-down.png)
3. Under the repository name, use the **{% octicon "code" aria-label="The code icon" %} Code** drop-down menu, and in the **Codespaces** tab, click {% octicon "plus" aria-label="The plus icon" %} **New codespace**.
1. Click the **{% octicon "code" aria-label="The code icon" %} Code** button, then click the **Codespaces** tab.
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
If you are a member of an organization and are creating a codespace on a repository owned by that organization, you can select the option of a different machine type. From the dialog box, choose a machine type and then click **Create codespace**.
1. Create your codespace, either using the default options, or after configuring advanced options:
* **Use the default options**
![Machine type choice](/assets/images/help/codespaces/choose-custom-machine-type.png)
To create a codespace using the default options, click **Create codespace on BRANCH**.
{% data reusables.codespaces.codespaces-machine-type-availability %}
Optionally, before clicking **Create codespace on BRANCH**, you can click the down arrow at the side of the button to see what machine type will be used for your codespace.
![View the default machine type](/assets/images/help/codespaces/default-machine-type.png)
{% note %}
**Note**: The machine type with the lowest resources that are valid for the repository is selected by default.
{% endnote %}
* **Configure options**
To configure advanced options for your codespace, such as a different machine type or a particular `devcontainer.json` file:
1. Click the down arrow at the side of the **Create codespace on BRANCH** button, then click **Configure and create codespace**.
1. Click the **Configure and create codespace** button.
1. On the options page for your codespace, choose your preferred options from the drop-down menus.
![The codespace options page](/assets/images/help/codespaces/advanced-options.png)
{% note %}
**Notes**
* You can bookmark the options page to give you a quick way to create a codespace for this repository and branch.
* The [https://github.com/codespaces/new](https://github.com/codespaces/new) page provides a quick way to create a codespace for any repository and branch.
* For more information about the `devcontainer.json` file, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#devcontainerjson)."
* For more information about machine types, see "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace#about-machine-types)."
* {% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
1. Click **Start session**.
{% endwebui %}
@@ -106,6 +140,12 @@ gh codespace create
You are prompted to choose a repository, a branch, and a machine type (if more than one is available).
{% note %}
**Note**: Currently, {% data variables.product.prodname_cli %} doesn't allow you to choose a dev container configuration when you create a codespace. If you want to choose a specific dev container configuration, use the {% data variables.product.prodname_dotcom %} web interface to create your codespace. For more information, click the "Web browser" tab at the top of this page.
{% endnote %}
Alternatively, you can use flags to specify some or all of the options:
```shell

View File

@@ -26,6 +26,7 @@ shortTitle: Delete a codespace
{% endnote %}
## Deleting a codespace
{% webui %}
@@ -54,11 +55,48 @@ To delete a codespace use the `gh codespace delete` subcommand and then choose a
gh codespace delete
```
If you have unsaved changes, you'll be prompted to confirm deletion. You can use the `-f` flag to force deletion, avoiding this prompt.
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 {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_codespace_delete).
{% endcli %}
## Bulk deleting codespaces
{% webui %}
You can use {% data variables.product.prodname_cli %} to delete several or all of your codespaces with a single command. For more information, click the **{% data variables.product.prodname_cli %}** tab near the top of this page.
{% endwebui %}
{% vscode %}
You can use {% data variables.product.prodname_cli %} to delete several or all of your codespaces with a single command. For more information, click the **{% data variables.product.prodname_cli %}** tab near the top of this page.
{% endvscode %}
{% cli %}
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
```
{% endcli %}
## Further reading
- [Codespaces lifecycle](/codespaces/developing-in-codespaces/codespaces-lifecycle)

View File

@@ -27,7 +27,7 @@ topics:
2. In the list of pull requests, click the pull request you'd like to open in {% data variables.product.prodname_codespaces %}.
3. On the right-hand side of your screen, click **{% octicon "code" aria-label="The code icon" %} Code**.
4. From the {% data variables.product.prodname_codespaces %} tab, click **New codespace**.
4. In the {% data variables.product.prodname_codespaces %} tab, click **Create codespace on BRANCH**.
![Option to open PR in a codespace](/assets/images/help/codespaces/open-with-codespaces-pr.png)
## Reviewing a pull request in {% data variables.product.prodname_codespaces %}

View File

@@ -75,9 +75,7 @@ Use the {% data variables.product.prodname_vs %} Marketplace to install the [{%
## Changing the machine type in {% data variables.product.prodname_vscode %}
{% data reusables.codespaces.codespaces-machine-types %}
You can change the machine type of your codespace at any time.
{% data reusables.codespaces.codespaces-machine-types %} You can change the machine type of your codespace at any time.
1. In {% data variables.product.prodname_vscode %}, open the Command Palette (`shift command P` / `shift control P`).
1. Search for and select "Codespaces: Change Machine Type."
@@ -90,7 +88,11 @@ You can change the machine type of your codespace at any time.
1. Choose the machine type you want to use.
{% data reusables.codespaces.codespaces-machine-type-availability %}
{% note %}
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
1. If the codespace is currently running, a message is displayed asking if you would like to restart and reconnect to your codespace now.
@@ -100,7 +102,6 @@ You can change the machine type of your codespace at any time.
## Deleting a codespace in {% data variables.product.prodname_vscode %}
{% data reusables.codespaces.click-remote-explorer-icon-vscode %}
{% data reusables.codespaces.deleting-a-codespace-in-vscode %}
## Switching to the Insiders build of {% data variables.product.prodname_vscode %}