'Passing nuget.exe restore username and password

I'm using the nuget command line to restore packages for a solution. The packages come from an internal nuget mirror which requires authentication.

I found documentation on setting the -source parameter and noticed the -username and -password parameters. It seems the last two parameters are only applicable for adding a source to a config file.

Does anyone know if there is in fact a way of just passing the username and password for a source via the command line only i.e negating the need for a config altogether?

https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-add-source

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source