Skip to main content

此版本的 GitHub Enterprise 将停止服务 2022-06-03. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

Securing your repository

You can use a number of GitHub features to help keep your repository secure.

Repository administrators and organization owners can configure repository security settings.

Introduction

This guide shows you how to configure security features for a repository. You must be a repository administrator or organization owner to configure security settings for a repository.

Your security needs are unique to your repository, so you may not need to enable every feature for your repository. For more information, see "GitHub security features."

Some features are available for all repositories. Additional features are available to enterprises that use GitHub Advanced Security. 更多信息请参阅“关于 GitHub Advanced Security”。

Managing access to your repository

The first step to securing a repository is to set up who can see and modify your code. For more information, see "Managing repository settings."

From the main page of your repository, click Settings, then scroll down to the "Danger Zone."

Setting a security policy

  1. From the main page of your repository, click Security.
  2. Click Security policy.
  3. Click Start setup.
  4. Add information about supported versions of your project and how to report vulnerabilities.

For more information, see "Adding a security policy to your repository."

Managing the dependency graph

Enterprise owners can configure the dependency graph and Dependabot 警报 for an enterprise. For more information, see "Enabling the dependency graph for your enterprise" and "Enabling Dependabot for your enterprise."

For more information, see "Exploring the dependencies of a repository."

Managing Dependabot 警报

Dependabot 警报 are generated when GitHub identifies a dependency in the dependency graph with a vulnerability.

Enterprise owners can configure the dependency graph and Dependabot 警报 for an enterprise. For more information, see "Enabling the dependency graph for your enterprise" and "Enabling Dependabot for your enterprise."

For more information, see "About Dependabot 警报."

Configuring 代码扫描

You can set up 代码扫描 to automatically identify vulnerabilities and errors in the code stored in your repository by using a CodeQL 分析工作流程 or third-party tool. For more information, see "Setting up 代码扫描 for a repository."

代码扫描 is available for organization-owned repositories if your enterprise uses GitHub Advanced Security.

Configuring 秘密扫描

秘密扫描 is available for organization-owned repositories if your enterprise uses GitHub Advanced Security. 秘密扫描 may already be enabled for your repository, depending upon your organization's settings.

  1. From the main page of your repository, click Settings.
  2. Click Security & analysis.
  3. If GitHub Advanced Security is not already enabled, click Enable.
  4. Next to 秘密扫描, click Enable.

Next steps

You can view and manage alerts from security features to address dependencies and vulnerabilities in your code. For more information, see "Viewing Dependabot 警报 for vulnerable dependencies," "Managing 代码扫描 for your repository," and "Managing alerts from 秘密扫描."