Mike
Mike

Reputation: 2510

Cannot push nuget to github packages

About three weeks ago I pushed a package to our github organisation's packages repository, I used the following command:

dotnet nuget push "<fullNameOfPackage.nupkg>"  --source "<Our-Org>"

I had previously create a personal access token which I had added to my nuget.config with the command:

dotnet nuget add source "https://nuget.pkg.github.com/<Our-Org>/index.json" --name "<Our-Org>" --username "<my-username>" --password "<my-token>" --store-password-in-clear-text

I have a copy of the nuget.config stored in the local directory for good measure.

As I said, this worked just fine three weeks ago, but today when I tried it with a new version of the package I got the following error:

PS G:\_dev\solution\project> dotnet nuget push bin\Debug\<fullNameOfPackage.nupkg>  --source "<Our-Org>"
warn : No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/<Our-Org>'. To save an API Key for a source use the 'setApiKey' command.
Pushing <fullNameOfPackage.nupkg> to 'https://nuget.pkg.github.com/<Our-Org>'...
  PUT https://nuget.pkg.github.com/<Our-Org>/
warn : invalid repo host 'nuget.pkg.github.com', only github (github.com) repositories allowed
  BadRequest https://nuget.pkg.github.com/<Our-Org>/ 1079ms
error: Response status code does not indicate success: 400 (Bad Request).

I've recreated the PAT, tried using curl, even tried using the NuGet Package Explorer to upload the file, nothing works - all I get is a 400.

Any thoughts would be appreciated... help? Please?

Upvotes: 1

Views: 694

Answers (1)

Mike
Mike

Reputation: 2510

Eventually a colleague worked this one out. The clue is in the full error message:

No destination repository detected. Ensure the source project has a 'RepositoryUrl' property defined. 

Unfortunately I thought the repository it was refering to was the packages repository and I was putting the packages URL in there, not the source code repo. URL - still doesn't explain how I managed to get the previous versions up there but now I know.

Upvotes: 1

Related Questions