创建代码空间

您可以为仓库中的分支创建代码空间以便在线开发。

Codespaces are available for repositories owned by organizations using GitHub Team and GitHub Enterprise Cloud.

Codespaces is available for organizations using GitHub Team or GitHub Enterprise Cloud. 更多信息请参阅“GitHub 的产品”。

关于代码空间的创建

您可以在 GitHub.com 或 Visual Studio Code 中创建代码。 您创建的每个代码空间只有您才可以使用。 其他任何人都不能在您的代码空间中工作。

代码空间与仓库的特定分支相关联,且仓库不能为空。 每个仓库甚至每个分支可创建多个代码空间。 However, each user account has a limit of 10 codespaces. 如果您已达到上限,想要创建一个新的代码空间,必须先删除一个旧代码空间。 更多信息请参阅“删除代码空间”。

When you create a codespace, a number of steps happen to create and connect you to your development environment:

  • Step 1: VM and storage are assigned to your codespace.
  • Step 2: Container is created and your repository is cloned.
  • Step 3: You can connect to the codespace.
  • Step 4: Codespace continues with post-creation setup.

For more information on what happens when you create a codespace, see "Deep Dive."

使用 Visual Studio Code 在代码空间中开发时,您可以编辑代码、调试和使用 Git 命令。 更多信息请参阅 Visual Studio Code 文档

您可以在 github.com/codespaces 上查看您创建的每一个可用代码空间。

Access to Codespaces

Codespaces are available for repositories owned by organizations using GitHub Team and GitHub Enterprise Cloud.

When you have access to Codespaces, you'll see a "Codespaces" tab within the Code drop-down menu when you view a repository.

You'll have access to codespaces under the following conditions:

  • You are a member of an organization that has enabled Codespaces and set a spending limit.
  • An organization owner has granted you access to Codespaces.
  • The repository is owned by the organization that has enabled Codespaces.

Note: Individuals who have already joined the beta with their personal GitHub account will not lose access to Codespaces, however Codespaces for individuals will continue to remain in beta.

Organization owners can allow all members of the organization to create codespaces, limit codespace creation to selected organization members, or disable codespace creation. For more information about managing access to codespaces within your organization, see "Enable Codespaces for users in your organization."

Before Codespaces can be used in an organization, an owner or billing manager must have set a spending limit. For more information, see "About spending limits for Codespaces."

If you would like to create a codespace for a repository owned by your personal account or another user, and you have permission to create repositories in an organization that has enabled Codespaces, you can fork user-owned repositories to that organization and then create a codespace for the fork.

创建代码空间

  1. 在 GitHub 上,导航到仓库的主页面。

  2. 在仓库名称下,使用“Branch(分支)”下拉菜单选择您要为其创建代码的分支。

    分支下拉菜单

  3. Under the repository name, use the Code drop-down menu, and in the Codespaces tab, click New codespace.

    新建代码空间按钮

    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, choose a machine type and then click Create codespace. Machine type choice

此文档对您有帮助吗?

隐私政策

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

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

做出贡献

或, 了解如何参与。