Skip to main content

为组织启用或禁用 GitHub Codespaces

你可以控制哪些用户可以在组织的专用存储库中使用 GitHub Codespaces。

谁可以使用此功能?

Organization owners can control which users can use GitHub Codespaces.

Organizations on GitHub Team and GitHub Enterprise plans can choose to disable GitHub Codespaces in private repositories. For more information, see GitHub 的计划.

About enabling and disabling GitHub Codespaces

GitHub Codespaces is always available in an organization's public repositories. Any user can create a codespace from these repositories.

If your organization is on a GitHub Free plan, GitHub Codespaces is always available in your organization's private repositories. Any user with access to these repositories can create a codespace at their own expense.

If you're an organization owner on a paid GitHub plan, you can enable or disable GitHub Codespaces for your organization's private repositories. You can enable GitHub Codespaces for all users or only for selected members and collaborators.

Enabling or disabling GitHub Codespaces

注意

Removing a user's access to GitHub Codespaces will prevent them from opening any of their existing codespaces in your organization's private repositories. For more details, see What happens when I remove a user's access to GitHub Codespaces?

  1. In the upper-right corner of GitHub, click your profile picture, then click Your organizations.
  2. Next to the organization, click Settings.
  3. In the left sidebar, click Codespaces.
  4. Under Codespaces, in the left sidebar, click General.
  5. On the Codespaces settings page, under "Codespaces access," select your preferred setting for GitHub Codespaces in your organization's private repositories.

Ensuring your users can create codespaces

To allow a user to create codespaces for a repository owned by your organization, you must do one of the following:

  • Give the user read access to the repository and permit forking. This allows the user to create a codespace, push changes to a fork, and open a pull request. For more information, see Managing the forking policy for your organization.
  • Give the user write access to the repository so that they can push changes directly to the repository without forking.

注意

If you are a verified educator or a teacher, you must enable GitHub Codespaces from a GitHub Classroom to use your Codespaces Education benefit. For more information, see Using GitHub Codespaces with GitHub Classroom.

What happens when I remove a user's access to GitHub Codespaces?

Before removing users' access to GitHub Codespaces, you should alert the affected users.

When you remove a user's access, the user will immediately be unable to open existing codespaces they have created from your organization's private repositories.

  • If you alert them first, they can push any unpublished work to a branch in the repository before they lose access.
  • Once a user loses access to a codespace, the codespace is retained for a period of 7 days, then it is permanently deleted. During this 7-day period, to recover unpublished work from the codespace, the user must contact us through the GitHub Support portal.

If you were previously paying for codespaces the user had created from your organization's public repositories, ownership of these codespaces will transfer to the user.

Further reading