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
-
На GitHubперейдите на главную страницу репозитория.
-
Под именем репозитория щелкните Settings. Если вкладка "Параметры" не отображается, выберите раскрывающееся меню и нажмите кнопку "Параметры".

-
В разделе "Безопасность" боковой панели щелкните Advanced Security.
-
Under "Secret Protection", to the right of "Push Protection", click Enable.