Can't push Nuget to Octopus packages repo from TeamCity


I have a TeamCity job running on a server that pushes a Nuget package on Octopus package repo (on a different server). For an unknown reason, this works with many projects on this TeamCity build server, but not this one. And I get the following error:

[13:21:06][Step 2/3] push: Publish package MyService.nupkg (3s)
[13:21:06][push] NuGet command: D:\BuildAgent\plugins\nuget-agent\bin\JetBrains.TeamCity.NuGetRunner.exe D:\BuildAgent\tools\NuGet.CommandLine.3.4.3\tools\NuGet.exe push D:\BuildAgent\work\8f2a3075b6a82181\MyService.nupkg %%teamcity_nuget_api_key_1498044066693%% -Source http://octopus:8080/nuget/packages
[13:21:06][push] Starting: D:\BuildAgent\temp\agentTmp\custom_script9155627391892705881.cmd
[13:21:06][push] in directory: D:\BuildAgent\work\8f2a3075b6a82181
[13:21:06][push] JetBrains TeamCity NuGet Runner 8.0.42538.9
[13:21:06][push] Registered additional extensions from paths: D:\BuildAgent\plugins\nuget-agent\bin\plugins-3.3
[13:21:06][push] Starting NuGet.exe from D:\BuildAgent\tools\NuGet.CommandLine.3.4.3\tools\NuGet.exe
[13:21:07][push] Pushing MyService.nupkg to ‘http://octopus:8080/nuget/packages’…
[13:21:07][push] PUT http://octopus:8080/nuget/packages/
[13:21:09][push] Forbidden http://octopus:8080/nuget/packages/ 2338ms
[13:21:09][push] Please provide credentials for: http://octopus:8080/nuget/packages
[13:21:09][push] Cannot prompt for input in non-interactive mode.
[13:21:09][push] UserName:
[13:21:09][push] Process exited with code 1
[13:21:09][Step 2/3] Step Push to Octopus (NuGet Publish) failed

I have read all possible articles on your forums and on the web, but I still can’t get this fixed. When publishing manually to Nuget, everything works.

Is there any issue with TeamCity pluggin that your guys at Octopus would be aware of ? Is there any tricky rights to grant on the target repo (that wouldn’t make sense as my other projects are perfectly working)

Thank you,

HI Pierre,

Thanks for reaching out! This usually means that the API Key using for the push is invalid.

Can you try creating a brand new API Key and then using it in your TC process? If that doesn’t work, could you try using the new API Key with Nuget.exe push manually from a command prompt and not through TC?


Hi Dalmiro,

Yes the API key was indeed the issue.
Basically, the API key that was used in my TC template, was created with a generic login that didn’t have the Publisher rights in Octopus roles.
Adding this publisher role solved the problem.

Thank you for your prompt reply on this,

Glad to hear its working now :slight_smile: