此版本的 GitHub Enterprise 将停止服务 2022-02-16. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

Deleting a package

You can delete a version of a private package using GraphQL or on GitHub Enterprise Server.

GitHub Packages is available with GitHub Free, GitHub Pro, GitHub Free for organizations, GitHub Team, GitHub Enterprise Cloud, GitHub Enterprise Server 3.0 or higher, and GitHub AE. For more information about upgrading your GitHub Enterprise Server instance, see "About upgrades to new releases" and refer to the Upgrade assistant to find the upgrade path from your current release version.

At this time, GitHub Packages on your GitHub Enterprise Server instance does not support deleting public packages.

You can only delete a specified version of a private package on GitHub Enterprise Server or with the GraphQL API. To remove an entire private package from appearing on GitHub Enterprise Server, you must delete every version of the package first.

Deleting a version of a private package on GitHub Enterprise Server

To delete a private package version, you must have admin permissions in the repository.

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

  2. 在文件列表右侧,单击 Packages(包)

    概述页面上的包链接

  3. Click the name of the package that you want to delete. Package name

  4. On the right, use the Edit package drop-down and select "Manage versions". Package name

  5. To the right of the version you want to delete, click Delete. Delete package button

  6. To confirm deletion, type the package name and click I understand the consequences, delete this version. Confirm package deletion button

Deleting a version of a private package with GraphQL

Use the deletePackageVersion mutation in the GraphQL API. You must use a token with the read:packages, delete:packages, and repo scopes. For more information about tokens, see "About GitHub Packages."

Here is an example cURL command to delete a package version with the package version ID of MDIyOlJlZ2lzdHJ5UGFja2FnZVZlcnNpb243MTExNg, using a personal access token.

curl -X POST \
-H "Accept: application/vnd.github.package-deletes-preview+json" \
-H "Authorization: bearer TOKEN" \
-d '{"query":"mutation { deletePackageVersion(input:{packageVersionId:\"MDIyOlJlZ2lzdHJ5UGFja2FnZVZlcnNpb243MTExNg==\"}) { success }}"}' \
HOSTNAME/graphql

To find all of the private packages you have published to GitHub Packages, along with the version IDs for the packages, you can use the packages connection through the repository object. You will need a token with the read:packages and repo scopes. For more information, see the packages connection or the PackageOwner interface.

For more information about the deletePackageVersion mutation, see "deletePackageVersion."

You cannot delete an entire package, but if you delete every version of a package, the package will no longer show on GitHub Enterprise Server.

此文档对您有帮助吗?

隐私政策

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

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

做出贡献

或者, 了解如何参与。