繁体   English   中英

do.net restore in Github Actions 给出 401 unauthorized

[英]dotnet restore in Github Actions gives 401 unauthorized

Github 上的 a.NET6 项目无法在 Github Actions 中执行 do.net-restored。 do.net restore在本地工作正常。 查看操作日志,GH 似乎在我的Github Packages Repo 中寻找 Microsoft 依赖项。 System.Linq是 MS 的东西。

  Retrying 'FindPackagesByIdAsync' for source 'https://nuget.pkg.github.com/mdddev/download/system.linq/index.json'.
  Response status code does not indicate success: 401 (Unauthorized).
/home/runner/.dotnet/sdk/6.0.202/NuGet.targets(130,5): warning : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured. [/home/runner/work/meh/meh/meh.sln]

在管道的下方,有一个将结果发布到 Github 包注册表的步骤,但是在项目本身中,我只使用公共 NUGET 引用。 我不确定为什么 GH Actions 在我的注册表中查找 .NET 内容。 我什至在我的nuget.config中配置了公共 Nuget 提要:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <clear />
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
        <add key="github" value="https://nuget.pkg.github.com/mdddev/index.json" />
    </packageSources>
</configuration>

有谁知道这里的问题是什么?

您在这里使用的是 GitHub 包,您必须对自己进行身份验证。
了解更多信息 -> https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry#authenticating-with-a-personal-access -令牌

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM