Reset NuGet credentials in VS2017
Asked Answered
B

8

103

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

Baize answered 23/10, 2017 at 13:54 Comment(1)
Have you checked Control Panel - User Accounts - Credential Manager?Pitiful
B
207

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.

Baize answered 23/10, 2017 at 14:26 Comment(4)
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.Incendiary
I wish there was a search function on that screen!Hobbism
This is still an effective method with VS2019 if you need to change the password for a private nuget feed. In my case, Telerik controls. As an aside, the account password for a vendor and the credentials for Nuget feeds should be two different things, we should be able to generate private nuget feed credentials and allow / deny them. Changing your Telerik account password currently requires changing the password everywhere it is used, even in CI environments due to insufficient abstraction, as far as I can tell...Osy
In my case the credentials was cached in the %appdata%\NuGet\NuGet.config file, and not in the windows credential manager.Illinium
B
22

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.

Bertina answered 28/6, 2018 at 14:50 Comment(1)
Had the exact same issue. Thanks for the help!Reprise
S
16

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 password which starts with VSCredential_ prefix with encrypted password.
  4. Close and open your visual studio & Rebuild your visual studio project.

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

Sanson answered 6/7, 2020 at 10:28 Comment(1)
Thanks, it was the only way to re-enter my correct password!Bulb
H
9

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.

Hileman answered 7/6, 2020 at 0:22 Comment(0)
B
3

You can delete your credentials from the Credential Manager or force update the package reference by executing the following command in the Package Manager Console: dotnet nuget update source "your package name" -s "your package source/url" -u "your username" -p "your password/token"

Blowy answered 30/5, 2022 at 8:33 Comment(0)
S
2

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"
Selfrevealing answered 9/2, 2021 at 10:22 Comment(1)
from all the garbage I found out there this is the most correct answerStephanus
D
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

Distress answered 4/2, 2020 at 2:12 Comment(0)
B
0

One of the things that sorted it out for us was removing a conflicting package version.

We were in the process of moving from a privately hosted NuGet feed to a Github-hosted feed, built by dotnet instead of Msbuild directly.

The dotnet version of the tool shortens versions from 1.0.1.0 to 1.0.1, but NuGet still treats them as equivalent. We had 1.0.1.0 coming from our old feed and 1.0.1 coming from the Github feed. This confused NuGet and we had lots of issues besides being prompted for the credentials, as I'm sure you can imagine.

Anyway, once we uprevved to 1.0.1.1 on Github, all our problems disappeared, including the credentials prompting.

Brathwaite answered 20/8, 2023 at 23:57 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.