Skip to main content

Diese Version von GitHub Enterprise Server wird eingestellt am 2026-03-17. Es wird keine Patch-Freigabe vorgenommen, auch nicht für kritische Sicherheitsprobleme. Für bessere Leistung, verbesserte Sicherheit und neue Features aktualisiere auf die neueste Version von GitHub Enterprise Server. Wende dich an den GitHub Enterprise-Support, um Hilfe zum Upgrade zu erhalten.

Push protection from the command line

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

Wer kann dieses Feature verwenden?

Benutzer*innen mit Schreibzugriff

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 Entfernen vertraulicher Daten aus einem Repository.

Hinweis

  • Wenn deine Git-Konfiguration das Pushen an mehrere Branches und nicht nur an den aktuellen Branch unterstützt, wird dein Push möglicherweise blockiert, weil zusätzliche und unbeabsichtigte Verweise gepusht werden. Weitere Informationen findest du unter push.default-Optionen in der GitHub-Dokumentation.
  • Wenn für secret scanning bei einem Push ein Timeout auftritt, scannt GitHub die Commits nach dem Pushen trotzdem auf Geheimnisse.