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).
nuget setapikey [apikey] -source [feedUrl]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password]
nuget setapikey [apikey] -source [feedUrl] -configFile [configFilePath]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password] -configFile [configFilePath]
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|update -Name [name] -source [feedUrl] -User [username] -pass [password] -configFile [configFilePath] -StorePasswordInClearText
Actually it is machine-level for the given user account you run these commands under. That's why it is important for build servers to run these under the build service account (cfr my post on debugging package restore: http://www.xavierdecoster.com/debugging-nuget-package-restore
Both the nuget.exe command line as well as the NuGet Visual Studio extension use the information stored in this config, so they'll pick up these credentials.