Unable to upload NuGet to GitHub packages using Actions #190691
-
🏷️ Discussion TypeQuestion 💬 Feature/Topic AreaWorkflow Configuration Discussion DetailsI really need help, I'm trying to get CI working properly with uploading the NuGet package for PLMIDI2VG onto GitHub packages. I have tried doing what was mentioned in this thread, but it doesn't work. While it does upload successfully to nuget.org, it does not upload to GitHub packages. The error that occurs, happens when it gets to Push package to GitHub packages: It's doesn't make any sense, I'm using the correct access token, it's a fine-grained token, and it should work. I have Can someone please help me out here and tell me what I'm doing wrong? I'm new to CI, and I really want to make sure that PLMIDI2VG publishes to GitHub packages. Any help would be greatly appreciated, thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Your workflow fails because env vars/secrets aren’t populating in the job likely missing permissions: packages: write at job level or the environment isn’t selected in the run (check workflow dispatch UI). Add this to your job: permissions: Then, explicitly add the NuGet source before push (replace OWNER with your username/org): dotnet nuget add source "https://nuget.pkg.github.com/OWNER/index.json" --username github-actions --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github No custom secrets needed GITHUB_TOKEN works if repo settings > Packages > 'Inherit access from repository' is on. Test on main branch |
Beta Was this translation helpful? Give feedback.
-
|
Hey! I’ve run into this exact 403 error before. Even with "write-all" permissions, the dotnet CLI is super picky about how it talks to GitHub. |
Beta Was this translation helpful? Give feedback.


Hey! I’ve run into this exact 403 error before. Even with "write-all" permissions, the dotnet CLI is super picky about how it talks to GitHub.
The main reason this happens is usually that the push command is missing the index.json part of the URL, or it’s having trouble mapping your "github" source name to your actual credentials.
Here is the quick fix to try in your YAML file:
In your "Push package to GitHub packages" step, instead of using just --source "github", try using the full, direct URL:
https://nuget.pkg.github.com/PlatinumLucario/index.json
Also, try swapping out your custom secret for the built-in secrets.GITHUB_TOKEN. Since you already have "permissions: write-all" in your sc…