我正在尝试发布一个 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.
问题是,我已经在使用我创建的个人访问令牌来执行此操作,并且它确实启用了读取包范围。