To set Git username in VS Code, open the integrated terminal and run:

bash

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

VS Code uses Git’s config for the commit name and email, and you can verify it with git config --list.

About password

Git usually does not store a plain password in VS Code anymore. For GitHub and similar services, authentication is typically handled by a browser sign- in, a credential manager, or a personal access token instead of a password.

If VS Code keeps asking again

  • On Windows, update or remove the saved entry in Credential Manager so you can sign in again with the correct account.
  • On macOS, check Keychain Access for saved GitHub credentials and update or delete the old one.
  • If you’re using GitHub in VS Code, sign out of the old account in the Accounts area, then sign in again with the correct one.

Simple workflow

  1. Open VS Code.
  2. Open the terminal.
  3. Set user.name and user.email.
  4. Re-authenticate with your Git host if needed.
  5. Try git push again.

Note

If you mean “change the account used to push,” that is separate from the Git username/email used for commits. The commit identity comes from Git config, while the login for pushing is managed by your credential store or Git host sign-in.

TL;DR: set git config --global user.name and git config --global user.email; for the password, re-sign in or update saved credentials rather than trying to store a plain password in VS Code.