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.

Кто может использовать эту функцию?

Владельцы репозитория, владелец организации, руководители безопасности и пользователи с ролью администратора

В этой статье

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 Сведения о включении функций безопасности в масштабе.

Organization owners, security managers, and repository administrators can also enable push protection for secret scanning via the API. For more information, see Конечные точки REST API для репозиториев 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 Создание настраиваемой конфигурации безопасности для предприятия.

Enabling push protection for a repository

  1. На GitHubперейдите на главную страницу репозитория.

  2. Под именем репозитория щелкните Settings. Если вкладка "Параметры" не отображается, выберите раскрывающееся меню и нажмите кнопку "Параметры".

    Снимок экрана: заголовок репозитория с вкладками. Вкладка "Параметры" выделена темно-оранжевым контуром.

  3. В разделе "Безопасность" боковой панели щелкните Advanced Security.

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

Further reading