user2178228
user2178228

Reputation: 173

How can I remove a GitHub password from Visual Studio Code?

I have cloned one of my GitHub repositories with Visual Studio Code and I have made some commits. Visual Studio Code has asked me for my GitHub password when I have done on the first commit.

I have rebooted the computer and now I can make commits as before, but Visual Studio Code does not ask for my password. It seems that the password has been stored. But this computer is not my computer and I do not want that somebody else could use my account.

How can I make Visual Studio Code forget my GitHub password?

I have tried the Git command:

git config --global --unset-all user.email

But Visual Studio Code still lets me commit without asking.

Upvotes: 12

Views: 59010

Answers (4)

Michael Rhema
Michael Rhema

Reputation: 171

For Ubuntu/GNOME Visual Studio Code users, the Credential Manager can be accessed by launching the "Passport and Keys" application. You can delete the Visual Studio Code/GitHub entry by clicking "Password", looking for the entry and delete.

Restart Visual Studio Code after, and it would ask you to sign into GitHub all over again.

Upvotes: 4

Pit
Pit

Reputation: 443

First you need to check where the passwords are located. The credentials store or the Windows generic password.

Run this in the Visual Studio Code terminal:

  git config credential.helper

Go to and delete the file C:\Users\(username)\.git-credentials or you can simply remove the @github user rows from the text file.

Then go to Windows password: Control PanelAll Control Panel ItemsCredential Manager. The passwords are referenced to the GitHub label in generic.

Then log in into your GitHub account with your default browser. After that, restart Visual Studio Code. Clone from GitHub and follow the authorization steps from Visual Studio Code.

Upvotes: 6

John Vandivier
John Vandivier

Reputation: 2426

I'm a long time user of Visual Studio Code on both Windows and Mac. After looking into Windows Credential Manager and removing the problematic user on Windows 10, if I push from Visual Studio Code, the problematic user would return. This is of course after restarting Visual Studio Code, the system, etc, and trying multiple times. The entry would reappear in Windows Credential Manager each time.

At some point I decided to try to edit the entry instead of deleting it. This approach worked. Give that approach a try if removing the entry doesn't seem to solve the issue.

Upvotes: 1

VonC
VonC

Reputation: 1325137

Check your git config credential.helper:

  • if it is manager, you would need to open your Windows Credential Manager and remove your credentials there.
    See this answer for illustration.
    Or, in command-line:

    printf "protocol=https\nhost=github.com" | git credential-manager-core erase
    
  • if it is a osxkeychain, see "Updating credentials from the OSX Keychain"

    printf "protocol=https\nhost=github.com" | git credential-osxkeychain erase
    

Reminder, those credentials (username/password) have nothing to do with your git config user.name/user.email.

Upvotes: 18

Related Questions