Nuget restore from github package manager giving 403

904 Views Asked by At

We have a private set of nuget packages in GitHub. Until recently, I was able to restore packages from this repository and view them in the package manager. Now, I'm getting 403 errors:

Retrying 'FindPackagesByIdAsync' for source 'https://nuget.pkg.github.com/MyCompany/download/MyPackage/index.json'. Response status code does not indicate success: 403 (Forbidden).

This source is setup in my Nuget.Config and previously worked.

What I've tried:

  • Regenerated my PAT
  • Deleted my PAT and created a new one.
  • Cleared the Nuget Cache
  • Cleared temp files from %AppData%\local\temp
  • Removed the VSCredentials_nuget.pkg.github.com credential. Also tried editing the credential and pasting in my new PAT.

Anything else I can try?

2

There are 2 best solutions below

0
Michael Witt On BEST ANSWER

Turns out, I forgot the "Configure SSO" step to authorize the PAT for SSO. Once I did that, it worked.

0
clenard On

I'm going to piggy back off this for anyone else who ended up here like me.

My issue was I was passing in my PAT via an organization level secret. I am on the "Team" level plan and apparently you can't use org level secrets in Action unless you have "Enterprise". I moved my PAT to a repository level secret and then everything worked.