[英]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 密码的方式。
It will then open window to connect to your project, here you can update your password.然后它将打开窗口以连接到您的项目,您可以在此处更新密码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.