Skip to main content

Enterprise Server 3.21 est actuellement disponible en tant que version candidate.

Push protection from the command line

Understand how GitHub uses push protection to prevent secret leaks from the command line.

Qui peut utiliser cette fonctionnalité ?

Utilisateurs avec accès en écriture

Push protection prevents you from accidentally committing secrets to a repository by blocking pushes containing supported secrets.

When you attempt to push a supported secret from the command line to a repository secured by push protection, GitHub will block the push.

You should either:

Up to five detected secrets will be displayed at a time on the command line. If a particular secret has already been detected in the repository and an alert already exists, GitHub will not block that secret.

If you confirm a secret is real and that you intend to fix it later, you should aim to remediate the secret as soon as possible. For example, you might revoke the secret and remove the secret from the repository's commit history. Real secrets that have been exposed must be revoked to avoid unauthorized access. You might consider first rotating the secret before revoking it. For more information, see Suppression de données sensibles dans un dépôt.

Remarque

  • Si votre configuration Git prend en charge les envois vers plusieurs branches, et non uniquement vers la branche par défaut, votre envoi peut être bloqué en raison de l’envoi (push) de références supplémentaires et involontaires. Pour plus d’informations, consultez les options push.default dans la documentation Git.
  • Si l’secret scanning à l’occasion de l’expiration d’un envoi (push), GitHub exécute toujours une analyse après l’envoi (push).