The Wayback Machine - https://web.archive.org./web/20201031233740/https://docs.github.com/cn/free-pro-team@latest/github/developing-online-with-codespaces/using-codespaces-in-visual-studio-code
我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

在 Visual Studio Code 中使用代码空间

您可以将 Visual Studio 代码空间 扩展连接到您在 GitHub 上的帐户,直接在 Visual Studio Code 代码空间中开发。

代码空间可用于使用 GitHub Free 或 GitHub Pro 的用户帐户。 For more information, see "GitHub's products."

本文内容

此文档对您有帮助吗?

帮助我们创建出色的文档!

所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。

做出贡献

或, 了解如何参与。

注:Codespaces 目前是有限公测版,可能会有变动。 在公测期间,GitHub 不对 Codespaces 的可用性做任何保证。 有关加入公测的更多信息,请参阅“关于 Codespaces”。

基本要求

直接在 Visual Studio Code 的代码空间中开发之前,您必须配置 Visual Studio 代码空间 扩展连接到您的 GitHub 帐户。

  1. 使用 Visual Studio Marketplace 安装 Visual Studio 代码空间 扩展。 更多信息请参阅 Visual Studio Code 文档中的扩展 Marketplace
  2. 在 Visual Studio Code 中,从左侧边栏单击 Extensions(扩展)图标。
    Visual Studio Code 中的 Extensions(扩展)图标
  3. 在 Visual Studio 代码空间 下面,单击 Manage(管理)图标,然后单击 Extension Settings(扩展设置)
    Extension Settings(扩展设置)选项
  4. 使用“Vsonline: Account Provider(Vsonline:帐户提供商)”下拉菜单,选择 GitHub。
    设置帐户提供者为 GitHub
  5. 在 Visual Studio Code 中,从左侧边栏单击 Remote Explorer 图标。
    Visual Studio Code 中的 Remote Explorer 图标
  6. 如果尚未在标题中选择 Codespaces,请单击 Codespaces
    Codespaces 标头
  7. 单击 Sign in to view Codespaces...(登录以查看 Codespaces...)
    登录以查看 Codespaces
  8. 要授权 Visual Studio Code 访问您在 GitHub 上的帐户,请单击 Allow(允许)
  9. 登录 GitHub 以审批扩展。

在 Visual Studio Code 中创建代码空间

After you connect your GitHub account to the Visual Studio 代码空间 extension, you can develop in a codespace that you created on GitHub or in Visual Studio Code.

  1. 在 Visual Studio Code 中,从左侧边栏单击 Remote Explorer 图标。
    Visual Studio Code 中的 Remote Explorer 图标
  2. Click the Add icon, then click Create New Codespace.
    The Create new Codespace option in Codespaces
  3. Type, then click the repository's name you want to develop in.
    Searching for repository to create a new Codespaces
  4. Click the branch you want to develop in.
    Searching for a branch to create a new Codespaces

在 Visual Studio Code 中打开代码空间

  1. 在 Visual Studio Code 中,从左侧边栏单击 Remote Explorer 图标。
    Visual Studio Code 中的 Remote Explorer 图标
  2. 在 Codespaces(代码空间)下,单击您要在其中开发的代码空间。
  3. 单击 Connect to Codespace(连接到代码空间)图标。
    Visual Studio Code 中的连接到代码空间图标

Deleting a codespace in Visual Studio Code

  1. Under Codespaces, right-click the codespace you want to delete.
  2. In the drop-down menu, click Delete Codespace.
    Deleting a codespace in GitHub

此文档对您有帮助吗?

帮助我们创建出色的文档!

所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。

做出贡献

或, 了解如何参与。