Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paumayr/8845667 to your computer and use it in GitHub Desktop.
Save paumayr/8845667 to your computer and use it in GitHub Desktop.

Execute the following script using your MyGet [feedUrl] and MyGet [username] , [password] and [apikey]. Run this from a commandline where you have access to nuget.exe (or set the path to your nuget.exe in a system environment variable).

Store credentials in machine-level nuget.config (non-transferable)

nuget setapikey [apikey] -source [feedUrl]
nuget sources add -Name [name] -source [feedUrl] -User [username] -pass [password]

Store credentials in specific nuget.config (non-transferable)

nuget setapikey [apikey] -source [feedUrl] -configFile [configFilePath]
nuget sources add -Name [name] -source [feedUrl] -User [username] -pass [password] -configFile [configFilePath]

Store credentials in specific nuget.config (transferable)

Don't bother putting the above nuget.config files into source control as they'll only work on the machine and the account that created the configs.

To be able to share credentials, use the -StorePasswordInClearText option:

nuget setapikey [apikey] -source [feedUrl] -configFile [configFilePath]
nuget sources add -Name [name] -source [feedUrl] -User [username] -pass [password] -configFile [configFilePath] -StorePasswordInClearText
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment