Change GIT account of Visual Studio Team Explorer

GitVisual StudioGithubAzure DevopsGit Credential-Manager

Git Problem Overview


I am having a very weird situation when cloning a Git repository from our company private server. The repository is not anonymous (it requires authentication), but when cloning, VS didn't ask any username and password and automatically use an old authentication of old employee. Is there a way to remove the saved username and password and make Visual Studio to prompt them when cloning?

Git Solutions


Solution 1 - Git

Look in the Windows Credential manager and remove/update your credentials there:

enter image description here

Solution 2 - Git

In my case just removing credentials from Windows Credential didn't fix it. I first removed all git and azure related accounts from Windows Credential, then removed accounts from VS>Files>Account Settings, and then VS asked me new credentials and connected to the project. But my commits were still made with the old account! Finally I found out that it was the git config:

C:\Users\[USER NAME]\.gitconfig

I deleted the whole user section in that file which looks like this:

[user]
    name = [OLD ACCOUNT NAME]
    email = [OLD ACCOUNT EMAIL]

On next commit VS asked me git account information and done.

If you want to work with different accounts for different projects on same machine, read this.

Solution 3 - Git

I am using VS 2017 and this is how I updated my Password for TFS, using Git repository.

  1. From the Menu: Team -> manage Connection
  2. Click on Manage Connection Link -> Connect to Project

enter image description here

It will then open window to connect to your project, here you can update your password.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLuke VoView Question on Stackoverflow
Solution 1 - GitjessehouwingView Answer on Stackoverflow
Solution 2 - GitsaastnView Answer on Stackoverflow
Solution 3 - GitHooman BahreiniView Answer on Stackoverflow