mirror command (NuGet CLI)

Applies to: package publishing • Supported versions: deprecated in 3.2+

Mirrors a package and its dependencies from the specified source repositories to the target repository.


NuGet.ServerExtensions.dll and NuGet-Signed.exe that previously supported this command in NuGet 2.x (by renaming NuGet-Signed.exe to nuget.exe) are no longer available for download. To use a command similar to this, try NuGetMirror.


nuget mirror <packageID | configFilePath> <listUrlTarget> <publishUrlTarget> [options]

where <packageID> is the package to mirror, or <configFilePath> identifies the packages.config file that lists the packages to mirror.

The <listUrlTarget> specifies the source repository, and <publishUrlTarget> specifies the target repository.

If your target repository is on https://machine/repo that's running NuGet.Server, the list and push urls will be https://machine/repo/nuget and https://machine/repo/api/v2/package, respectively.


  • -ApiKey

    The API key for the target repository. If not present, the one specified in the config file is used (%AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux)).

  • -Help

    Displays help information for the command.

  • -NoCache

    Prevents NuGet from using cached packages. See Managing the global packages and cache folders.

  • -Noop

    Logs what would be done but does not perform the actions; assumes success for push operations.

  • -PreRelease

    Includes prerelease packages in the mirroring operation.

  • -Source

    A list of package sources to mirror. If no sources are specified, the ones defined in the config file (see ApiKey above) are used, defaulting to nuget.org if none are specified.

  • -Timeout

    Specifies the timeout, in seconds, for pushing to a server. The default is 300 seconds (5 minutes).

  • -Version

    The version of the package to install. If not specified, the latest version is mirrored.

Also see Environment variables


nuget mirror packages.config  https://MyRepo/nuget https://MyRepo/api/v2/package -source https://nuget.org/api/v2 -apikey myApiKey -nocache

nuget mirror Microsoft.AspNet.Mvc https://MyRepo/nuget https://MyRepo/api/v2/package -version 4.0.20505.0

nuget mirror Microsoft.Net.Http https://MyRepo/nuget https://MyRepo/api/v2/package -prerelease