About push protection for secret scanning
The push protection feature of secret scanning helps to prevent security leaks by scanning for secrets before you push changes to your repository. Al habilitar la protección de inserción, secret scanning también comprueba si hay secretos de alta confianza (los identificados con una tasa de falsos positivos baja). Secret scanning enumera los secretos que detecta para que el creador pueda revisarlos y quitarlos, o si es necesario, permitir que se inserten. For information on the secrets and service providers supported for push protection, see "Secret scanning patterns."
Si confirmas que un secreto es real, debes quitar el secreto de la rama, de todas las confirmaciones en las que aparece, antes de volver a insertar.
Tip If GitHub blocks a secret that you believe is safe to push, you can allow the secret and specify the reason why it should be allowed. For more information about bypassing push protection for a secret, see "Allowing a blocked secret to be pushed" and "Bypassing push protection for a secret" for the command line and the web UI, respectively.
Resolving a blocked push on the command line
Al intentar insertar un secreto admitido en un repositorio u organización con secret scanning como protección de inserción habilitada, GitHub bloqueará la inserción. Puedes quitar el secreto de la rama o seguir una dirección URL proporcionada para permitir la inserción.
Notas:
- Si la configuración de Git admite inserciones en varias ramas y no solo en la actual, es posible que se bloquee la inserción debido a que se insertan referencias adicionales y no deseadas. Para obtener más información, consulta las opciones
push.defaulten la documentación de Git. - Si se agota el tiempo de espera de secret scanning tras una inserción, GitHub todavía examinará las confirmaciones en busca de secretos después de la inserción.
If the blocked secret was introduced by the latest commit on your branch, you can follow the guidance below.
- Remove the secret from your code.
- Commit the changes, by using
git commit --amend. - Push your changes with
git push.
You can also remove the secret if the secret appears in an earlier commit in the Git history.
- Use
git logto determine which commit surfaced in the push error came first in history. - Start an interactive rebase with
git rebase -i <commit-id>~1.is the id of the commit from step 1. - Identify your commit to edit by changing
picktoediton the first line of the text that appears in the editor. - Remove the secret from your code.
- Commit the change with
git commit --amend. - Run
git rebase --continueto finish the rebase.
Resolving a blocked commit in the web UI
Cuando se usa la interfaz de usuario web para intentar confirmar un secreto admitido en un repositorio u organización con el examen de secretos como protección de inserción habilitada, GitHub bloqueará la confirmación.
Verás un banner en la parte superior de la página con información sobre la ubicación del secreto, y el secreto también estará subrayado en el archivo para que puedas encontrarlo fácilmente.

To resolve a blocked commit in the web UI, you need to remove the secret from the file, or use the Bypass protection dropdown to allow the secret. For more information about bypassing push protection from the web UI, see "Protecting pushes with secret scanning."
If you confirm a secret is real, you need to remove the secret from the file. Once you remove the secret, the banner at the top of the page will change and tell you that you can now commit your changes.