Deleting a package
You can delete a version of a private package using the API or, under special circumstances, ask GitHub Support to delete a public package.
GitHub Packages is available with GitHub Free, GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. GitHub Packages is unavailable for per-repository plans, which are legacy billing plans. For more information, see "GitHub's products."
In this article
About package deletion
To avoid breaking projects that may depend on your packages, you cannot delete an entire public package or specific versions of a public package. Under special circumstances, such as for legal reasons or to conform with GDPR standards, you can ask GitHub Support to delete a public package for you, using our contact form.
To prevent confusion and build problems, you cannot edit or change package versions. Once you publish a version of a package, that version number is permanently reserved, even if the version is later deleted. If you want to revise or replace a package version, you must publish a new version with a new version number.
Package names are also permanently reserved. Even if you delete all versions of a package, you cannot publish another package with that name to any other repository owned by the same account.
Deleting a version of a private package
Anyone with admin permissions to a repository can delete a version of a private package in that repository.
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 }}"}' \
https://api.github.com/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 registryPackagesForQuery
connection. You will need a token with the read:packages
and repo
scopes. For more information, see "registryPackagesForQuery
" in the GitHub Developer documentation.
For more information about the deletePackageVersion
mutation, see "deletePackageVersion
" in the GitHub Developer documentation.
You cannot delete an entire package, but if you delete every version of a package, the package will no longer show on GitHub.