Skip to main content

Troubleshooting creation and deletion of codespaces

This article provides troubleshooting steps for common issues you may experience when creating or deleting a codespace, including storage and configuration issues.

GitHub Codespaces 可用于使用 GitHub Team 或 GitHub Enterprise Cloud 的组织。 GitHub Codespaces 也可作为受限的 beta 版本提供给使用 GitHub Free 和 GitHub Pro 计划的个人用户。 有关详细信息,请参阅“GitHub 的产品”。

Creating codespaces

No access to create a codespace

GitHub Codespaces is not available for all repositories. If the "Open with Codespaces" button is missing, GitHub Codespaces may not be available for that repository. For more information, see "Creating a codespace."

You can't create a codespace for a private repository that's owned by an organization, unless you have write access to the repository or the organization has enabled forking for it.

If you believe your organization has enabled GitHub Codespaces, make sure that an organization owner or billing manager has set the spending limit for GitHub Codespaces. For more information, see "Managing your spending limit for GitHub Codespaces."

Codespace does not open when created

If you create a codespace and it does not open:

  1. Try reloading the page in case there was a caching or reporting problem.
  2. Go to your GitHub Codespaces page: and check whether the new codespace is listed there. The process may have successfully created the codespace but failed to report back to your browser. If the new codespace is listed, you can open it directly from that page.
  3. Retry creating the codespace for the repository to rule out a transient communication failure.

If you still cannot create a codespace for a repository where GitHub Codespaces is available, 可能需要联系支持人员。 有关详细信息,请参阅“使用支持”。

Deleting codespaces

The owner of a codespace has full control over it and only they can delete their codespaces. You cannot delete a codespace created by another user.

You can delete your codespaces in the browser, in Visual Studio Code, or by using GitHub CLI. GitHub CLI also allows you to bulk delete codespaces. For more information, see "Deleting a codespace."

Container storage

When you create a codespace, it has a finite amount of storage and over time it may be necessary for you to free up space. Try running any of the following commands in the GitHub Codespaces terminal to free up storage space.

  • Remove packages that are no longer used by using sudo apt autoremove.
  • Clean the apt cache by using sudo apt clean.
  • See the top 10 largest files in the codespace withsudo find / -printf '%s %p\n'| sort -nr | head -10.
  • Delete unneeded files, such as build artifacts and logs.

Some more destructive options:

  • Remove unused Docker images, networks, and containers by using docker system prune (append -a if you want to remove all images, and --volumes if you want to remove all volumes).
  • Remove untracked files from working tree: git clean -i.


如果对 codespace 配置的更改导致容器错误,则 codespace 将在恢复模式下运行,并且你将看到错误消息。

This codespace is currently running in recovery mode due to a container error.

Review the creation logs, update the dev container configuration as needed, and run Codespaces: Rebuild Container in the Visual Studio Code Command Palette to retry. For more information, see "GitHub Codespaces logs" and "Introduction to dev containers."