Zarickan
Zarickan
CC#
Created by Zarickan on 4/19/2023 in #help
❔ How to pull nuget packages from private Github registry when doing dotnet restore in Github action
Does anyone know how to run dotnet restore from a Github action on a project that uses nuget packages from a private Github repository? I am currently adding the appropriate package source to nuget.config using
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/USERNAME/index.json"
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/USERNAME/index.json"
However dotnet restore fails with the error:
/usr/share/dotnet/sdk/7.0.203/NuGet.targets(132,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/path-to.sln]
/usr/share/dotnet/sdk/7.0.203/NuGet.targets(132,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/path-to.sln]
4 replies