查看依赖关系图
The dependency graph shows the dependencies and dependents of your repository. 有关依赖项检测以及支持哪些生态系统的信息,请参阅“关于依赖关系图”。
- 在 GitHub 上,导航到仓库的主页面。
- 在仓库名称下,单击 Insights(洞察)。
- 在左侧边栏中,单击 Dependency graph(依赖图)。
- (可选)在 "Dependency graph"(依赖关系图)下,单击 Dependents(依赖项)。
依赖项视图
依赖项按生态系统分组。 您可以展开依赖项以查看其依赖项。 For dependencies on public repositories hosted on GitHub, you can also click a dependency to view the repository. 私有仓库、私有包或无法识别文件上的依赖项以纯文本显示。
如果在仓库中检测到漏洞,这些漏洞将显示在视图顶部,供有权访问 Dependabot alerts 的用户查看。
依赖项视图
对于公共仓库,依赖项视图显示其他仓库如何使用该仓库。 要在包管理器中仅显示包含存储库的仓库,请单击依赖的仓库列表正上方的编号包。 依赖项计数是近似值,不一定与列出的依赖项匹配。
为私有仓库启用或禁用依赖关系图
仓库管理员可以启用或禁用私有仓库的依赖关系图。
您也可以为用户帐户或组织拥有的所有仓库启用或禁用依赖项图。 更多信息请参阅“管理用户帐户的安全和分析设置”或“管理组织的安全和分析设置”。
- 在 GitHub 上,导航到仓库的主页面。
- 在仓库名称下,单击 Settings(设置)。
- 在左侧边栏中,单击 Security & analysis(安全和分析)。
- 阅读有关授予 GitHub 只读访问仓库数据的消息,以启用依赖关系图,然后在“Dependency Graph(依赖关系图)”旁边单击 Enable(启用)。
您可以随时单击 Security & analysis(安全性和分析)选项卡上“Dependency Graph(依赖关系图)”旁边的 Disable(禁用)来禁用依赖关系图。
Changing the "Used by" package
If the dependency graph is enabled, and your repository contains a package that's published on a supported package ecosystem, GitHub displays a "Used by" section in the sidebar of the Code tab of your repository. For more information about the supported package ecosystems, see "About the dependency graph."
The "Used by" section shows the number of public references to the package that were found, and displays the avatars of some of the owners of the dependent projects.
Clicking any item in this section takes you to the Dependents tab of the dependency graph.
The "Used by" section represents a single package from the repository. If you have admin permissions to a repository that contains multiple packages, you can choose which package the "Used by" section represents.
- 在 GitHub 上,导航到仓库的主页面。
- 在仓库名称下,单击 Settings(设置)。
- 在左侧边栏中,单击 Security & analysis(安全和分析)。
- Under "Configure security and analysis features", click the drop-down menu in the "Used by counter" section and choose a package.
依赖项图疑难排解
如果依赖关系图为空,则包含依赖项的文件可能有问题。 检查该文件以确保其格式对文件类型是正确的。
如果文件格式正确,请检查文件大小。 The dependency graph ignores individual manifest and lock files that are over 0.5 Mb, unless you are a GitHub Enterprise user. 默认情况下,每个仓库最多处理 20 个清单或锁定文件,因此您可以在仓库子目录中将依赖项拆分为较小的文件。
如果清单或锁定文件未获处理,其依赖项将从依赖关系图中省略,而不能接受有漏洞依赖项的检查。