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 Team 或 GitHub Enterprise Cloud 的组织。 更多信息请参阅“GitHub 的产品”。

Creating codespaces

No access to create a codespace

Codespaces are not available for all repositories. If the "Open with Codespaces" button is missing, Codespaces may not be available for that repository. 更多信息请参阅“创建代码空间”。

If you believe your organization has enabled Codespaces, make sure that an organization owner or billing manager has set the spending limit for Codespaces. 更多信息请参阅“管理 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 Codespaces page: https://github.com/codespaces 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 Codespaces are available, you may need to contact support. For more information, see "Working with support."

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.

Container storage

创建代码空间时,存储量是有限的,随着时间的推移,可能需要释放空间。 Try running any of the following commands in the Codespaces terminal to free up storage space.

  • Remove packages that are no longer used by using sudo apt autoremove.
  • 使用 sudo apt clean 清理 apt 缓存.
  • 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).
  • 从工作树中删除不跟踪的文件:git clear-i.

Configuration

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

由于容器错误,这个代码空间正在恢复模式中运行。

Review the creation logs, update the configuration as needed, and run Codespaces: Rebuild Container in the VS Code Command Palette to retry. For more information, see " Codespaces logs" and "Configuring Codespaces for your project."

此文档对您有帮助吗?

隐私政策

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

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

做出贡献

或者, 了解如何参与。