Publicamos atualizações frequentes em nossa documentação, e a tradução desta página ainda pode estar em andamento. Para obter as informações mais recentes, acesse a documentação em inglês. Se houver problemas com a tradução desta página, entre em contato conosco.

Excluir um pacote

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

GitHub Package Registry is available with GitHub Free, GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub One. GitHub Package Registry is not available for private repositories owned by accounts using legacy per-repository plans. For more information, see "GitHub's products."

Neste artigo

About private package deletion

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

About public 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 Suporte do GitHub to delete a public package for you, using our contact form.

Reserved package versions and names

To prevent confusion and build problems, GitHub permanently reserves a package's name and version number. Even if an entire package is deleted, you cannot reuse the deleted package name in any repository owned by the same account.

To revise or replace a package version, we recommend you publish a new version of your package.

Deleting a version of a private package on GitHub

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

  1. No GitHub, navegue até a página principal do repositório.
  2. Above the list of files, click NUMBER packages.
    Packages link on overview page
  3. Click the name of the package that you want to delete.
    Nome do pacote
  4. On the right, use the Edit package drop-down and select "Manage versions".
    Nome do pacote
  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 Package Registry."

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 Package Registry, 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 documentação do GitHub Developer.

For more information about the deletePackageVersion mutation, see "deletePackageVersion" in documentação do GitHub Developer.

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

Pergunte a uma pessoa

Não consegue encontrar o que procura?

Entrar em contato