Changing the git user inside Visual Studio Code

后端 未结 8 1816
时光取名叫无心
时光取名叫无心 2020-12-04 16:53

The user for my git commits has changed, but I am not able to change that inside of Visual Studio Code.

I changed the global settings in git, but when I want to push

相关标签:
8条回答
  • 2020-12-04 16:56

    There is a conflict between Visual Studio 2015 and Visual Studio Code for the git credentials. When i changed my credentials on VS 2015 VS Code let me push with the correct git ID.

    0 讨论(0)
  • 2020-12-04 17:00

    You can view all of your settings and where they are coming from using:

    git config --list --show-origin
    

    Delete the unwanted credentials from the directory and then VSCode ask you for the next time you perform git operation.

    0 讨论(0)
  • 2020-12-04 17:02

    I resolved this issue by setting an email address in Git:

    git config --global user.email "email@example.com"
    
    0 讨论(0)
  • 2020-12-04 17:04

    Press Ctrl + Shift + G in Visual Studio Code and go to more and select Show git output. Click Terminal and type git remote -v and verify that the origin branch has latest username in it like:

    origin git@github.com:DroidPulkit/Facebook-Chat-Bot.git (fetch)

    origin git@github.com:DroidPulkit/Facebook-Chat-Bot.git (push)

    Here DroidPulkit is my username.

    If the username is not what you wanted it to be then change it with:

    git add remote origin git@github.com:newUserName/RepoName.git
    
    0 讨论(0)
  • 2020-12-04 17:07

    From VSCode Commande Palette select :

    GitHub Pull Requests : Sign out of GitHub.

    Then Sign in with your new credential.

    0 讨论(0)
  • 2020-12-04 17:11

    Generally VSCode uses the github credentials from system's credential manager, it doesn't store anywhere in the settings. As question says Changing the git user inside Visual Studio Code, is not inside rather outside.

    Search for or Go to credential manager (Windows control panel) -> Windows Credentials -> Update the GitHub password from the list.

    0 讨论(0)
提交回复
热议问题