必要な環境
Visual Studio Code の Codespaces で直接開発するには、GitHub Codespaces 機能拡張にサインインする必要があります。 GitHub Codespaces 機能拡張には、Visual Studio Code October 2020 Release 1.51 以降が必要です。
Visual Studio Marketplace を使用して、GitHub Codespaces 機能拡張をインストールします。 詳しい情報については、Visual Studio Code ドキュメントの「Extension Marketplace」を参照してください。
- Visual Studio Codeの左サイドバーで、 Remote Explorerのアイコンをクリックしてください。

- [Sign in to view GitHub...] をクリックします。
![[Signing in to view Codespaces]](/web/20211009212404im_/https://docs.github.com/assets/images/help/codespaces/sign-in-to-view-codespaces-vscode-mac.png)
- Visual Studio Code からの GitHub のアカウントへのアクセスを承認するには、[Allow] をクリックします。
- 機能拡張を承認するには、GitHub にサインインします。
- Visual Studio Codeの左サイドバーで、 Remote Explorerのアイコンをクリックしてください。

- [REMOTE EXPLORER] ドロップダウンを使用して、[GitHub Codespaces] をクリックします。

- [Sign in to view Codespaces...] をクリックします。
![[Signing in to view Codespaces]](/web/20211009212404im_/https://docs.github.com/assets/images/help/codespaces/sign-in-to-view-codespaces-vscode.png)
- Visual Studio Code からの GitHub のアカウントへのアクセスを承認するには、[Allow] をクリックします。
- 機能拡張を承認するには、GitHub にサインインします。
Visual Studio Code で Codespaces を作成する
GitHub アカウントを GitHub Codespaces 機能拡張に接続した後、GitHub または Visual Studio Code で作成した Codespaces で開発できます。
- Visual Studio Codeの左サイドバーで、 Remote Explorerのアイコンをクリックしてください。

- [Add] アイコンをクリックしてから、[Create New Codespace] をクリックします。
![Codespaces の [Create New Codespace] オプション](/web/20211009212404im_/https://docs.github.com/assets/images/help/codespaces/create-codespace-vscode.png)
- 入力し、開発するリポジトリの名前をクリックします。

- 開発するブランチをクリックします。

- 開発するマシンタイプをクリックします。

Visual Studio Code で codespace を開く
- Visual Studio Codeの左サイドバーで、 Remote Explorerのアイコンをクリックしてください。

- [Codespaces] で、開発するコードスペースをクリックします。
- [Connect to Codespace] アイコンをクリックします。
![Visual Studio Code の [Connect to Codespace] アイコン](/web/20211009212404im_/https://docs.github.com/assets/images/help/codespaces/click-connect-to-codespace-icon-vscode.png)
Changing the machine type in Visual Studio Code
You can run your codespace on a choice of remote machine, from 2 cores to 32 cores. これらはそれぞれ、異なるレベルのリソースと支払い層を持っています。 For information, see "About billing for Codespaces."
You can change the machine type of your codespace at any time.
- In Visual Studio Code, open the Command Palette (
shift command P/shift control P). - Search for and select "Codespaces: Change Machine Type."

- Click the codespace that you want to change.

- Choose the machine type you want to use.
If the codespace is currently running, a message is displayed asking if you would like to restart and reconnect to your codespace now. Click Yes if you want to change the machine type used for this codespace immediately. If you click No, or if the codespace is not currently running, the change will take effect the next time the codespace restarts.
Visual Studio Code で Codespaces を削除する
- [Codespaces] で、削除するコードスペースを右クリックします。
- ドロップダウンメニューで、[Delete Codespace] をクリックします。
