Change GIT account of Visual Studio Team Explorer

后端 未结 3 1402
忘掉有多难
忘掉有多难 2020-12-13 08:06

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 clon

3条回答
  •  北海茫月
    2020-12-13 08:40

    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.

提交回复
热议问题