更改 Visual Studio Team Explorer 的 GIT 帐户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31051146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:20:11  来源:igfitidea点击:

Change GIT account of Visual Studio Team Explorer

gitvisual-studiovisual-studio-2013azure-devopsgit-credential-manager

提问by Luke Vo

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 存储库时,我遇到了一个非常奇怪的情况。存储库不是匿名的(它需要身份验证),但是在克隆时,VS 没有询问任何用户名和密码并自动使用老员工的旧身份验证。有没有办法删除保存的用户名和密码并让 Visual Studio 在克隆时提示它们?

回答by jessehouwing

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

查看 Windows 凭据管理器并在那里删除/更新您的凭据:

enter image description here

在此处输入图片说明

回答by saastn

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:

就我而言,仅从 Windows Credential 中删除凭据并不能解决问题。我首先从 Windows Credential 中删除了所有与 git 和 azure 相关的帐户,然后从 VS>Files>Account Settings 中删除了帐户,然后 VS 询问我新的凭据并连接到项目。但是我的提交仍然是用旧帐户进行的!最后我发现这是 git 配置:

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.

在下一次提交时,VS 询问了我的 git 帐户信息并完成了。

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

如果您想在同一台机器上为不同的项目使用不同的帐户,请阅读

回答by Hooman Bahreini

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

我正在使用 VS 2017,这就是我使用 Git 存储库更新 TFS 密码的方式。

  1. From the Menu: Team -> manage Connection
  2. Click on Manage ConnectionLink -> Connect to Project
  1. 从菜单:团队 -> 管理连接
  2. 单击管理连接链接 -> 连接到项目

enter image description here

在此处输入图片说明

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

然后它将打开窗口以连接到您的项目,您可以在此处更新密码。