简体   繁体   English

更改 Visual Studio Team Explorer 的 GIT 帐户

[英]Change GIT account of Visual Studio Team Explorer

I am having a very weird situation when cloning a Git repository from our company private server.从我们公司的私人服务器克隆 Git 存储库时,我遇到了一个非常奇怪的情况。 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.存储库不是匿名的(它需要身份验证),但是在克隆时,VS 没有询问任何用户名和密码并自动使用老员工的旧身份验证。 Is there a way to remove the saved username and password and make Visual Studio to prompt them when cloning?有没有办法删除保存的用户名和密码并让 Visual Studio 在克隆时提示它们?

Look in the Windows Credential manager and remove/update your credentials there:查看 Windows 凭据管理器并在那里删除/更新您的凭据:

在此处输入图片说明

In my case just removing credentials from Windows Credential didn't fix it.就我而言,仅从 Windows Credential 中删除凭据并不能解决问题。 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.我首先从 Windows Credential 中删除了所有与 git 和 azure 相关的帐户,然后从 VS>Files>Account Settings 中删除了帐户,然后 VS 询问我新的凭据并连接到项目。 But my commits were still made with the old account!但是我的提交仍然是用旧帐户进行的! Finally I found out that it was the git config:最后我发现这是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 .如果您想在同一台机器上为不同的项目使用不同的帐户,请阅读

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 Connection Link -> Connect to Project单击管理连接链接 -> 连接到项目

在此处输入图片说明

It will then open window to connect to your project, here you can update your password.然后它将打开窗口以连接到您的项目,您可以在此处更新密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Git - 在 Team Explorer Visual Studio 上撤消提交 - Git - Undo a commit on Team Explorer Visual Studio Visual Studio Team Explorer - 查看 Git 命令 - Visual Studio Team Explorer - View Git Commands Visual Studio Team Explorer失去了Visual Studio Online的Git授权 - Visual Studio Team Explorer lost Git authorization for Visual Studio Online 如何使用git在Visual Studio Team Explorer中撤消凉亭更改? - How do I undo a bower change in Visual Studio Team Explorer using git? 团队资源管理器+ Visual Studio Online + Git不同步 - Team Explorer + Visual Studio Online + Git out of sync 是否可以恢复在 Visual Studio -> Team Explorer -> Git 中所做的撤消更改? - Is it possible to revert the undo changes done in Visual Studio -> Team Explorer -> Git? 在Team Explorer中为Visual Studio 2013选择GIT MERGE的选项在哪里? - Where is the option to do a GIT MERGE in Team Explorer for Visual Studio 2013? 如何使 git push origin --force ; 在 Visual Studio 团队资源管理器中 - how to make git push origin --force ; in Visual Studio Team Explorer git - Visual Studio 团队资源管理器显示的更改实际上并不存在 - git - Visual studio team explorer is showing changes that are not actually there Visual Studio Team Explorer-GIT:自动忽略新文件 - Visual Studio Team Explorer - GIT: Automatically ignoring new files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM