Publish to internal Nuget fails with 403 error

Hi,

I’ve just upgraded to Octopus Deploy 2.1.3.1223, and have decided to try using the internal NuGet repository. I’m using Octopack 3 from TFS, and my build fails, giving me a (403) Forbidden error when trying to publish to the NuGet repository.

Previously I’ve been using a file system path to hold our NuGet packages, and this still works fine, it’s just the NuGet repository that is giving me grief.

I’ve tried running NuGet.exe to do the publish, and also get the same error:

The remote server returned an error: (403) Forbidden..

Anyone been able to successfully get this working, and might have some pointers for me please?

Hi,

Are you specifying your API key when you push to the internal repository? What URL are you using? Could you share how you are telling TFS to push to this feed?

Paul

Hi Paul,

Yes, I’m specifying the API key, and I’m using OctoPack from a Team Build by applying the following MSBuild parameters:

/p:RunOctoPack=true 
/p:OctoPackPublishToHttp=http://<octopus server name>:9000/nuget/packages
/p:OctoPackPublishApiKey=<api key>

My API key is the one I’ve retrieved from my user profile in the Octopus Dashboard.

My Octopus install is set up on port 9000, hence the URL has the port number.

Interestingly, I’ve just run a build again, with these settings, and the build completed successfully, OctoPack did its thing, but the packages don’t appear to be in the repository…

If I run nuget directly, I still get the 403 error…The NuGet command line I’m using is as follows:

NuGet.exe push "<my nuget package name>.nupkg" -ApiKey <api key> -s http://<octopus server name>:9000/nuget/packages

The package exists, and the API key and server URL are the same as with the OctoPack above…

Ok…hmmm…so if I add the “API-” to the front of my API key (I’d left it off, since it seemed odd - my bad!!), then NuGet is able to upload to the internal NuGet repository…

I’m still not gettting any joy from OctoPack however. It’s creating the packages, and finishing successfully, but without pushing the packages to the repository.

Hi Mark,

The parameter to force the publish is:

/p:OctoPackPublishPackageToHttp=…

Hope that helps,

Paul

Thanks Paul, it does help…I’m pretty sure that I had that correct earlier, when I was getting the 403 error from Octopack initially. I’d messed around with my MSBuild parameters a few times since then, trying things, and mis-typed it when I was re-adding it again.

I’ve now got it working, and it seems the issue originally was that I had used my API key without the “API-” at the front of it. I’d assumed for some reason that this wasn’t actually part of the API key…I think I needed more coffee lol

Thanks for your help…
Mark

Thanks Mark!