[git] Changing the git user inside Visual Studio Code

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 or sync via Visual Studio Code inside my new repos I get the error that the oldusername has not the permission to push into newrepository. At this point it is not the permission. The change of the username did not work for visual studio code. When I use the terminal I can push. It is also not a solution to allow the olduser to push to the newrepository.

I am on Windows 10. So all other tools are working, but just at Visual Studio Code I was not able to change the user.

Any recomondations are welcome.

This question is related to git visual-studio-code

The answer is

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

git config --global user.email "[email protected]"

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.

I had the same problem as Daniel, setting the commit address and unsetting the credentials helper also worked for me.

git config --global user.email '<git-commit-address>'
git config --global --unset credential.helper

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 [email protected]:DroidPulkit/Facebook-Chat-Bot.git (fetch)

origin [email protected]: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 [email protected]:newUserName/RepoName.git

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.

This could be because of the reason that the credentials are saved and you need to update those credentials and you can do that by following the below steps

control panel-> credential manager ->under generic credential you will be able to see the credentials related to git

Try to update them if that does not work delete them and add new ones

for other platforms or different versions of the operating system you need to find out where the credentails are saved related to git and update them.

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.

From VSCode Commande Palette select :

GitHub Pull Requests : Sign out of GitHub.

Then Sign in with your new credential.

from within the vscode terminal,

git remote set-url origin https://<your github username>:<your password>@github.com/<your github username>/<your github repository name>.git

for the quickest, but not so encouraged way.

Questions with git tag:

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio? How to know the git username and email saved during configuration? How to add a new project to Github using VS Code git clone error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 fatal: ambiguous argument 'origin': unknown revision or path not in the working tree HTTP Basic: Access denied fatal: Authentication failed npm notice created a lockfile as package-lock.json. You should commit this file Do I commit the package-lock.json file created by npm 5? Abort a Git Merge key_load_public: invalid format git - remote add origin vs remote set-url origin Visual Studio 2017 - Git failed with a fatal error Get git branch name in Jenkins Pipeline/Jenkinsfile Changing the git user inside Visual Studio Code How to compare different branches in Visual Studio Code Git checkout - switching back to HEAD Clear git local cache Deleting a local branch with Git Rebuild Docker container on file changes Cloning specific branch How to add chmod permissions to file in Git? Git copy changes from one branch to another Git merge with force overwrite Project vs Repository in GitHub How to add a file to the last commit in git? Getting permission denied (public key) on gitlab Delete commit on gitlab gpg failed to sign the data fatal: failed to write commit object [Git 2.10.0] Remove a modified file from pull request Updates were rejected because the tip of your current branch is behind its remote counterpart Can't push to the heroku How to discard local changes and pull latest from GitHub repository In Visual Studio Code How do I merge between two local branches? error: RPC failed; curl transfer closed with outstanding read data remaining Change drive in git bash for windows Checkout Jenkins Pipeline Git SCM with credentials? How to fix git error: RPC failed; curl 56 GnuTLS Trying to pull files from my Github repository: "refusing to merge unrelated histories" Visual Studio Code how to resolve merge conflicts with git? merge one local branch into another local branch Can't push to remote branch, cannot be resolved to branch

Questions with visual-studio-code tag:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app Visual Studio Code PHP Intelephense Keep Showing Not Necessary Error Cannot edit in read-only editor VS Code How to setup virtual environment for Python in VS Code? Pylint "unresolved import" error in Visual Studio Code Why do I keep getting Delete 'cr' [prettier/prettier]? How to set up devices for VS Code for a Flutter emulator VSCode single to double quote automatic replace js 'types' can only be used in a .ts file - Visual Studio Code using @ts-check How can I clear the terminal in Visual Studio Code? Is there any way to set environment variables in Visual Studio Code? How to connect TFS in Visual Studio code How to shift a block of code left/right by one space in VSCode? How to add a new project to Github using VS Code Is there a way to remove unused imports and declarations from Angular 2+? How to create a Java / Maven project that works in Visual Studio Code? Select all occurrences of selected word in VSCode How to see local history changes in Visual Studio Code? VSCode cannot find module '@angular/core' or any other modules #include errors detected in vscode ESLint not working in VS Code? Visual Studio Code - Target of URI doesn't exist 'package:flutter/material.dart' What is a 'workspace' in Visual Studio Code? VSCode Change Default Terminal Visual Studio Code Search and Replace with Regular Expressions Visual Studio Code open tab in new window Activating Anaconda Environment in VsCode Error message "Linter pylint is not installed" Switch focus between editor and integrated terminal in Visual Studio Code Collapse all methods in Visual Studio Code How do I use Bash on Windows from the Visual Studio Code integrated terminal? Changing the git user inside Visual Studio Code Color theme for VS Code integrated terminal How to compare different branches in Visual Studio Code How to restart VScode after editing extension's config? Moving Panel in Visual Studio Code to right side Restore a deleted file in the Visual Studio Code Recycle Bin VSCode: How to Split Editor Vertically Install a Nuget package in Visual Studio Code How to indent/format a selection of code in Visual Studio Code with Ctrl + Shift + F How to change the integrated terminal in visual studio code or VSCode PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting How to do tag wrapping in VS code? Debug/run standard java in Visual Studio Code IDE and OS X? Visual Studio Code: How to show line endings How do you format code on save in VS Code Is there a quick change tabs function in Visual Studio Code? Duplicate line in Visual Studio Code Open files always in a new tab In Visual Studio Code How do I merge between two local branches?