{"meta":{"title":"上传 SARIF 结果需要 GitHub 令牌","intro":"需要为上传过程提供一种身份验证方法，以用于访问存储库。","product":"安全性和代码质量","breadcrumbs":[{"href":"/zh/code-security","title":"安全性和代码质量"},{"href":"/zh/code-security/reference","title":"Reference"},{"href":"/zh/code-security/reference/code-scanning","title":"代码扫描"},{"href":"/zh/code-security/reference/code-scanning/sarif-files","title":"SARIF 文件"},{"href":"/zh/code-security/reference/code-scanning/sarif-files/troubleshoot-sarif-uploads","title":"解决 SARIF 上传中的问题"},{"href":"/zh/code-security/reference/code-scanning/sarif-files/troubleshoot-sarif-uploads/missing-token","title":"缺少 GitHub 令牌"}],"documentType":"article"},"body":"# 上传 SARIF 结果需要 GitHub 令牌\n\n需要为上传过程提供一种身份验证方法，以用于访问存储库。\n\n## 关于此错误\n\n```text\nA GitHub token is required to upload SARIF results but none was specified\n```\n\n如果上传过程未引用身份验证方法，或者该方法具有错误的权限，则会报告此错误。 无论使用哪种过程上传数据，将 SARIF 文件上传到存储库所需的权限都是相同的。\n\n* 细化 personal access tokens 需要存储库的 `write` 范围。\n* 经典 personal access tokens 需要存储库私有或内部存储库的 `security_events` 范围。 可以将令牌与公共存储库的 `public_repo` 范围一起使用。\n* GitHub Apps 需要存储库的 `security_events` 范围。\n\n对于使用任何工具创建和使用任何方法上传的 SARIF 文件，你可能会看到此错误。\n\n## 修复问题\n\n使用正确的权限创建新的 personal access token 或 GitHub App。 有关详细信息，请参阅“[管理个人访问令牌](/zh/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)”或“[以GitHub应用身份进行身份验证](/zh/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app)”和“[决定何时生成GitHub应用](/zh/apps/creating-github-apps/about-creating-github-apps/deciding-when-to-build-a-github-app)”。"}