Skip to main content

Enabling push protection for your repository

With push protection, secret scanning blocks contributors from pushing secrets to a repository and generates an alert whenever a contributor bypasses the block.

Wer kann dieses Feature verwenden?

Repositorybesitzerinnen, Organisationsbesitzerinnen, Sicherheitsmanagerinnen und Benutzerinnen mit der Administratorrolle

About enabling push protection

To enable push protection for a repository, you must first enable Secret Protection. You can then enable push protection in the repository's "Advanced Security" settings page following the steps outlined in this article.

You can additionally enable push protection for your own personal account, which prevents you from pushing secrets to any public repository on GitHub. For more information, see Push protection for users.

If you're an organization owner, you can enable push protection for multiple repositories at a time using security configurations. For more information, see Informationen zum Aktivieren von Sicherheitsfeatures im großen Stil.

Organization owners, security managers, and repository administrators can also enable push protection for secret scanning via the API. For more information, see REST-API-Endpunkte für Repositorys and expand the "Properties of the security_and_analysis object" section.

If your organization is owned by an enterprise account, an enterprise owner can also enable push protection at the enterprise level. For more information, see Erstellen einer benutzerdefinierten Sicherheitskonfiguration für dein Unternehmen.

Enabling push protection for a repository

  1. Navigieren Sie auf GitHub zur Hauptseite des Repositorys.

  2. Klicke unter dem Repositorynamen auf Settings. Wenn die Registerkarte „Einstellungen“ nicht angezeigt wird, wähle im Dropdownmenü die Option Einstellungen aus.

    Screenshot eines Repositoryheaders mit den Registerkarten. Die Registerkarte „Einstellungen“ ist dunkelorange umrandet.

  3. Klicke im Abschnitt „Security“ der Randleiste auf Advanced Security.

  4. Under "Secret Protection", to the right of "Push Protection", click Enable.

Further reading