Unable to push .net framework package to github 422

I am having trouble trying to push .net framework packages to github


To pack: .nuget\NuGet.exe pack “C:\projects\reponame\ABC.Package” -OutputDirectory “C:\projects\reponame\ABC.Package\bin\Release”
To push .nuget\Nuget.exe push ABC.Package\bin\Release\abc.package.13.1.0.nupkg -Source https://github.com/orgname/repo-name

Have tried adding in a API key param to the nuget push but that returns a 403 forbidden without it prompts for username and password which seems to get a little further before getting a response of "Response status code does not indicate success: 422 (Unprocessable Entity) "

.nuspec file is:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata minClientVersion="4.00">
    <repository type="git" url="https://github.com/orgname/repo-name" />
    <copyright>Copyright 2020</copyright>

Can anyone help or is this not supported by GitHub?

You would need to use something like this:

nuget.exe push ABC.Package\bin\Release\abc.package.13.1.0.nupkg -Source https://nuget.pkg.github.com/orgname -ApiKey <PAT with write:packages and repo scope>

Note the source is https://nuget.pkg.github.com/orgname not a GitHub repo. The associated repo is specified using the repository element of your .nuspec or (more commonly) the RepositoryUrl property of your .csproj.

I hope that helps!

1 Like

Thanks so much, have been pulling my hair out on this for a while.