vscode: Git fails to auto-detect user.name and user.email after update to 1.52.0

  • VSCode Version: 1.52.0
  • OS Version: Windows 10 Version 1909 18363.1198 + Windows Server 2019 Version 1809 17763.1577

Steps to Reproduce:

  1. Update to Visual Studio Code 1.52.0
  2. Have empty values for user.name and user.email in git config (git config --global user.name and git config --global user.email)
  3. Try to commit anything to a repository
  4. Commit fails with the following error (which should usually only appear when auto-detection is disabled, which it is not)

image

Git Output:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: no email was given and auto-detection is disabled
> git config --get-all user.name

Note: This does not happen when committing directly through a shell (for example powershell or mingw64), so it has to be a problem with VS Code.

Does this issue occur when all extensions are disabled?: Yes

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 22 (3 by maintainers)

Most upvoted comments

A lot of users probably don’t use the git command line (a lot) and just use the interface VSCode and the Git extension give them. The Learn More button links to a git-scm page that may be confusing to them. It would be nice to be able to configure this from within vscode / the git extension.

As an alternative: Maybe give us the possibility to enable the auto-detection in the settings?

EDIT: Alternatively, maybe make it a warning instead of an error? At least that is what git does as well

this worked for me.

git config user.name “name” git config user.email name@changeme.com

But it has to be entered in each project.

git config --global does not really work


VS-Version: Version: 1.52.0 (user setup) Commit: 940b5f4bb5fa47866a54529ed759d95d09ee80be Date: 2020-12-10T22:45:11.850Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.19042

@CoreTechnologyAG @GuilhermeAbacherli I know how to resolve it, the reason why I opened this issue is because i think it can be done better. @eamodio could you take a Look at our suggestions? They are as following: Suggestion 1: Make an option in the settings to enable/disable auto-detect Suggestion 2: Make it a Warning instead of an error (Like git does as well) Suggestion 3: Give us the option to set user.name and user.email directly from VS Code (By @mrwensveen and @abby-d )

In the project’s directory I typed the following: git config --global user.email "thesame@email.com" git config --global user.name "My Name" And it worked for me.

This change was by-design, as it can be a privacy issue to allow Git to glean information from your machine without you knowing. We recommend setting your username and e-mail address in your .gitconfig file.

I can only get it to work without --global, however I have to do this everytime I clone a repo now because --global never works