59

I've specified wrong credentials, which then were remembered. How do I make NuGet forget it?

kagetoki
  • 3,109
  • 3
  • 11
  • 15

6 Answers6

132

As SayusiAndo guessed, the credentials were stored in Control Panel -> Credential Manager. After removing of which everything works fine.

UPDATE: Two gotchas (as @Jurri mentioned in the comments):

  1. There may be two credentials to delete (Windows and Generic). The generic one, in my case, had "VSCredentials_" prefix.

  2. Restart VS.

knaos
  • 751
  • 6
  • 10
kagetoki
  • 3,109
  • 3
  • 11
  • 15
  • 11
    Two gotchas: 1) There may be two credentials to delete (Windows and Generic). The generic one, in my case, had "VSCredentials_" prefix. 2) Restart VS. – Jurri Feb 19 '18 at 11:21
  • I wish there was a search function on that screen! – NickG Nov 26 '20 at 13:47
16

I ran into a situation where the NuGet credentials I entered into Visual Studio were not in my Credential Manager. Deleting the package source in Visual Studio, closing Visual Studio, reopening Visual Studio, and recreating the package source allowed me to re-enter my credentials.

Hence, if the credentials don't exist in the Credential Manager, it appears deleting the package source and closing Visual Studio may be sufficient to cause Visual Studio to forget the saved credentials.

Sander
  • 421
  • 4
  • 10
2

You can also try looking in %AppData%\..\Local\NuGet\v3-cache. Some credentials (or configuration pointing to the credentials) are stored in a subfolder that starts with a guid, then a dollar sign, then the feed address. In my case I needed to reset my credentials for the Telerik feed, and the folder was named:

9908746e042bf0f6edf045e1c69a504b09f96883$https_nuget.telerik.com_nuget

I merely deleted the folder, restarted VS, and was asked to enter my credentials.

ViRuSTriNiTy
  • 4,581
  • 1
  • 27
  • 52
Jay Taplin
  • 490
  • 4
  • 11
2

For me this isssue happens if i updated my system password. I fixed this problem by updating the passwords.

Steps:

  1. Go to Control Panel -->User Account -->Credential Manager
  2. In window credentials section update the password of your artifactory with encrypted password.
  3. In Generic Credential section update your generic passord which starts with VSCredential_ prefix with excrypted password.
  4. Rebuild your visual studio project.

You can get encrypted password from you artifactory site(JFrog) user profile section.

Joee
  • 1,104
  • 11
  • 15
0

I had to go into the credential manager and remove the machine name, i.e. in Cred Mgr my

User Name was: 10.4.4.4\username

needed to edit back to:

User Name: username

0

At least for Visual studio 2017 besides cleaning up credential cache - it does makes sense to wipe up nuget cache folder, as it keeps nuget packages downloaded locally - and then will not try any remote connection while restoring.

Run following two commands from command prompt, after that nuget authentication will be removed:

del /f "%localappdata%\MicrosoftCredentialProvider\SessionTokenCache.dat"
rmdir /s /q "%localappdata%\NuGet"
TarmoPikaro
  • 3,568
  • 1
  • 32
  • 42