Skip to main content

此版本的 GitHub Enterprise Server 已于以下日期停止服务 2026-06-02. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

Enabling secret scanning for your repository

You can configure how GitHub scans your repositories for leaked secrets and generates alerts.

谁可以使用此功能?

Secret scanning 可用于以下存储库类型:

  • 公共存储库:Secret scanning 自动且免费地运行。
  •           **组织拥有的私有和内部存储库**:在 GitHub Advanced Security 或 GitHub Team 上启用 [GitHub Enterprise Cloud](/get-started/learning-about-github/about-github-advanced-security) 后可用。
    
  • 用户拥有的存储库:在 GitHub Enterprise Cloud 上可用,配合 Enterprise Managed Users。 当企业启用了 GitHub Enterprise Server 时,可在 GitHub Advanced Security 上使用。

About enabling 机密扫描

机密扫描 can be enabled for any repository that is owned by an organization, and for repositories owned by user accounts when using GitHub Enterprise Cloud with Enterprise Managed Users.

If you're an organization owner, you can enable secret scanning for multiple repositories at a time using security configurations. For more information, see 大规模启用安全功能.

If your organization is owned by an enterprise account, an enterprise owner can also enable secret scanning at the enterprise level. For more information, see 为企业创建自定义安全配置.

Enabling 机密扫描

  1. 在 GitHub 上,导航到存储库的主页面。

  2. 在仓库名称下,单击 “Settings”****。 如果看不到“设置”选项卡,请选择“”下拉菜单,然后单击“设置”。

    存储库标头的屏幕截图,其中显示了选项卡。 “设置”选项卡以深橙色边框突出显示。

  3. 在边栏的“Security”部分中,单击“ Code security and analysis”****。

  4. When you enable Advanced Security, secret scanning may automatically be enabled for the repository due to the organization's settings. If "Secret scanning" is shown with an Enable button, you still need to enable secret scanning by clicking Enable. If you see a Disable button, secret scanning is already enabled.

    Screenshot of the "Secret scanning" section of the "Code security and analysis" page, with the "Enable" button highlighted in a dark orange outline.

A repository administrator can choose to disable secret scanning for a repository at any time. For more information, see 管理存储库的安全和分析设置.

Next steps