0

我正在尝试发布一个 Gradle 项目。我已遵循 GitHub 提供的所有文档,但是当我发送发布命令时,我从服务器收到 401 错误。

Execution failed for task ':publishGprPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'gpr' to repository 'GitHubPackages'
   > Could not GET 'https://maven.pkg.github.com/PowerInnovations/Data-Model/com/powerinnovations/data-model/0.0.1-SNAPSHOT/maven-metadata.xml'. Received status code 401 from server: Unauthorized

转到该页面并登录到 Github 后,它说:

Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:packages'], but your token has only been granted the: [''] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.

问题是,我已经在使用我创建的个人访问令牌来执行此操作,并且它确实启用了读取包范围。

4

1 回答 1

0

我确实得到了 Github 支持成员的解决方案。

支持人员在一封电子邮件中说:“发布包时,您的 PAT 需要 repo 范围以及对与您的包关联的 repo 的写入权限。”

他们一致认为,在这种情况下,服务器的响应具有误导性。

于 2020-05-29T17:07:22.110 回答