dotnet nuget push fails to authenticate
See original GitHub issueDescription
I can’t get authentication to work after reading the README section and related issues (https://github.com/NuGet/Home/issues/8580#issuecomment-599056152).
I want to:
- restore dependencies from nuget.org
- publish a package to GPR
Details
I have a nuget.config in my repo with just the source I need to restore dependencies.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Then I added the bit of yaml that configures the GPR source-url and adds authentication.
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
source-url: https://nuget.pkg.github.com/stevenliekens/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: dotnet pack --configuration Release --output artifacts --version-suffix CI-$(date --utc '+%Y%m%d-%H%M%S')
- run: dotnet nuget push artifacts/*.nupkg
No matter what I do, I get an error on the last step saying that my API key is missing.
warn : No API Key was provided and no API Key could be found for ‘https://nuget.pkg.github.com/stevenliekens’. To save an API Key for a source use the ‘setApiKey’ command.
Can this be a bug in the action? I don’t see what I could possibly be missing.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top Results From Across the Web
nuget push to artifacts from build script fails to authenticate
I've got the YAML to trigger and run the build, and it builds but fails to push the artifacts into the nuget repository....
Read more >Unauthorized error when trying to push nuget package to ...
The dotnet nuget push command pushes a package to the server and publishes it. The push command uses server and credential details found...
Read more >Why do nuget push commands authenticate yet still return a ...
When performing a nuget push command, you notice your command ultimately fails due to a 401 response even though the repository manager request...
Read more >NuGetAuthenticate@1 - NuGet authenticate v1 task
This task configures nuget.exe, dotnet, and MSBuild to authenticate with Azure Artifacts or other repositories that require authentication.
Read more >Pushing to MyGet from VSTS fails with "Forbidden"
Symptoms · Cause and solution · 1) Make sure the feed you are using is in NuGet. · 2) In VSTS, configure two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems the original problem with not using the given token would be solved by #109 (not released in v1 yet). The nuget file was being generated into a temp folder outside the repo path and was not being used.
My conclusion is that you have to do one of two things:
<clear />
element from your nuget.configSo this will never work:
Option A:
Option B: