dotnet nuget push: Publish a Package to a Feed
dotnet nuget push uploads one or more .nupkg files to a configured NuGet feed using an API key.
push is the release step. The flags that matter handle authentication, the target feed, and re-running the job idempotently.
What it does
dotnet nuget push uploads a .nupkg (and its symbols package, if present) to the feed named by --source, authenticating with --api-key. With --skip-duplicate it treats an already-published version as success instead of failing.
Common usage
dotnet nuget push ./artifacts/*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicateOptions
| Flag | What it does |
|---|---|
| <package> | Path or glob of the .nupkg to push |
| -k, --api-key <key> | API key for the feed |
| -s, --source <url> | Target feed (a URL or a named source) |
| --skip-duplicate | Treat an existing version as success (exit 0) |
| -n, --no-symbols | Do not push the symbols package |
| --timeout <seconds> | Push timeout per package |
In CI
Read the API key from a secret, never inline it. Add --skip-duplicate so a re-run of a release job (or a multi-package glob that partially succeeded) does not fail on the version that already exists. Push from a fixed artifacts directory produced by dotnet pack -o.
Common errors in CI
"Response status code does not indicate success: 401 (Unauthorized)" means the API key is wrong, expired, or lacks push scope on that feed. "409 (Conflict): The feed already contains 'X 1.2.3'" means that exact version exists; bump the version or pass --skip-duplicate. "403 (Forbidden)" on a private feed usually means the key is valid but not authorized to push to that feed.