# 依赖项关系图

您可以使用依赖关系图来识别项目的所有依赖项。 依赖关系图支持一系列流行的软件包生态系统。

<!--Marketing-LINK: From /features/security and /features/security/software-supply-chain pages "How GitHub's dependency graph is generated".-->

## 关于依赖关系图

依赖项关系图是存储在存储库中的清单和锁定文件以及使用 依赖项提交 API 提交给存储库的任何依赖项的摘要。 对于每个存储库，它显示 依赖关系，即它所依赖的生态系统和包。

对于每个依赖项，可以看到版本、包含它的清单文件，以及它是否具有已知漏洞。 对于支持传递性依赖项的包生态系统，将显示依赖关系状态。你可以单击 <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-kebab-horizontal" aria-label="Show dependency options" role="img"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg>，然后选择“Show paths”，以查看引入该依赖项的传递路径。

还可以使用搜索栏搜索特定依赖项。 依赖项会自动排序，存在漏洞的包排在最上方。

GitHub 不检索依赖项的许可信息，也不计算有关依赖项、仓库和依赖于仓库的包的信息。

有关受支持生态系统和清单文件的信息，请参阅 [依赖项关系图支持的包生态系统](/zh/enterprise-server@3.22/code-security/reference/supply-chain-security/dependency-graph-supported-package-ecosystems#supported-package-ecosystems)。

当你创建一个针对默认分支且包含依赖项更改的拉取请求时，GitHub 会使用依赖关系图将依赖项审查添加到该拉取请求中。 它们指示依赖项是否包含漏洞，如果是，则指示已修复漏洞的依赖项版本。 有关详细信息，请参阅“[依赖项审查](/zh/enterprise-server@3.22/code-security/concepts/supply-chain-security/dependency-review)”。

## 如何生成依赖项关系图

依赖项关系图通过分析存储库中的清单和锁定文件来自动分析依赖项。 还可以自行提交数据。 有关详细信息，请参阅“[依赖项图如何识别依赖项](/zh/enterprise-server@3.22/code-security/concepts/supply-chain-security/dependency-graph-data)”。

## 依赖关系图可用性

企业所有者可以为企业配置依赖关系图和 Dependabot alerts。 有关详细信息，请参阅 [为企业启用依赖项关系图](/zh/enterprise-server@3.22/code-security/how-tos/secure-at-scale/configure-enterprise-security/configure-specific-tools/enable-dependency-graph) 和 [为企业启用 Dependabot](/zh/enterprise-server@3.22/admin/configuring-settings/configuring-github-connect/enabling-dependabot-for-your-enterprise)。

有关依赖项图配置的详细信息，请参阅 [启用依赖项关系图](/zh/enterprise-server@3.22/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/enable-dependency-graph)。

## 如何使用依赖项图处理任务

您可以使用依赖关系图：

* 查看代码依赖的存储库。 有关详细信息，请参阅“[探索仓库的依赖项](/zh/enterprise-server@3.22/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/explore-dependencies)”。
* 查看和更新仓库中有漏洞的依赖项。 有关详细信息，请参阅“[Dependabot 警报](/zh/enterprise-server@3.22/code-security/concepts/supply-chain-security/dependabot-alerts)”。
* 查看拉取请求中有漏洞依赖项的相关信息。 有关详细信息，请参阅“[审核拉取请求中的依赖项变更](/zh/enterprise-server@3.22/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request)”。
* 导出软件物料清单（SBOM），以便进行审核或合规性目的。 这是项目依赖项的正式计算机可读清单。 请参阅“[导出存储库的软件物料清单](/zh/enterprise-server@3.22/code-security/how-tos/secure-your-supply-chain/establish-provenance-and-integrity/export-dependencies-as-sbom)”。

## 延伸阅读

* [依赖图](https://en.wikipedia.org/wiki/Dependency_graph)在维基百科上的介绍
* [探索仓库的依赖项](/zh/enterprise-server@3.22/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/explore-dependencies)
* [查看和更新 Dependabot 警报](/zh/enterprise-server@3.22/code-security/how-tos/manage-security-alerts/manage-dependabot-alerts/view-dependabot-alerts)
* [脆弱性依赖检测](/zh/enterprise-server@3.22/code-security/reference/supply-chain-security/troubleshoot-dependabot/vulnerability-detection)