Skip to main content

Developing in a codespace

You can open a codespace on GitHub, then develop using Visual Studio Code's features.

You can develop in codespaces you've created for repositories owned by organizations using GitHub Team and GitHub Enterprise Cloud.

GitHub Codespaces 可用于使用 GitHub Team 或 GitHub Enterprise Cloud 的组织。 更多信息请参阅“GitHub 的产品”。

About development with GitHub Codespaces

GitHub Codespaces provides you with the full development experience of Visual Studio Code. 使用 VS 代码 在代码空间中开发时,您可以编辑代码、调试和使用 Git 命令。 更多信息请参阅 VS 代码 文档

要开始使用 Codespaces,请参阅“GitHub Codespaces快速入门</0>”。 要了解有关 Codespaces 工作原理的更多信息,请参阅“深入了解 GitHub Codespaces”。

Codespace overview with annotations

  1. Side Bar - By default, this area shows your project files in the Explorer.
  2. Activity Bar - This displays the Views and provides you with a way to switch between them. You can reorder the Views by dragging and dropping them.
  3. Editor - This is where you edit your files. You can use the tab for each editor to position it exactly where you need it.
  4. Panels - This is where you can see output and debug information, as well as the default place for the integrated Terminal.
  5. Status Bar - This area provides you with useful information about your codespace and project. For example, the branch name, configured ports, and more.

For more information on using VS 代码, see the User Interface guide in the VS 代码 documentation.

您可以直接从 VS 代码 连接至您的代码空间。 更多信息请参阅“在 VS 代码 中使用代码空间”。

为获取 Codespaces 最佳使用体验,建议使用基于 Chromium 的浏览器,如 Google Chrome 或 Microsoft Edge。 For more information, see "Troubleshooting Codespaces clients."

Personalizing your codespace

您还可以使用 dotfiles 仓库和设置同步来针对您创建的任何代码空间而个性化代码空间环境的各个方面。 个性化可以包括 shell 首选项和其他工具。 For more information, see "Personalizing GitHub Codespaces for your account."

在仓库的 GitHub Codespaces 配置更改后,您可以通过重建代码空间的容器来将更改应用于现有代码空间。 For more information, see "Configuring Codespaces for your project."

Running your app from a codespace

您可以转发代码空间中的端口以测试和调试应用程序。 您还可以管理端口协议并在组织内或公开共享端口。 For more information, see "Forwarding ports in your codespace."

Committing your changes

在对代码空间进行更改(无论是添加新代码还是更改配置)之后,您需要提交更改。 将更改提交到仓库可确保从此仓库创建代码空间的其他任何人都具有相同的配置。 这也意味着您所做的任何自定义,例如添加 VS 代码 扩展,都会显示给所有用户。


Using the Visual Studio 代码命令面板

The Visual Studio 代码命令面板 allows you to access and manage many features for Codespaces and VS 代码. For more information, see "Using the VS 代码命令面板 in Codespaces."

  1. 您可以在 上查看您创建的每一个可用代码空间。
  2. Click the name of the codespace you want to develop in. Name of codespace

Alternatively, you can see any active codespaces for a repository by navigating to that repository and selecting Code. The drop-down menu will display all active codespaces for a repository.