Skip to content

fix: respect git.requireGitUserConfig setting on commit errors#304983

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/require-git-user-config
Open

fix: respect git.requireGitUserConfig setting on commit errors#304983
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/require-git-user-config

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When git.requireGitUserConfig is set to false, committing still shows the error message "Make sure you configure your user.name and user.email in git" if any commit error occurs and user.name or user.email is not configured.

The issue is in handleCommitError(): regardless of the requireUserConfig setting, it always checks for user.name and user.email on any commit failure and throws NoUserNameConfigured/NoUserEmailConfigured errors, masking the actual commit error.

Closes #194102

What is the new behavior?

The requireUserConfig flag is now passed from the commit() method to handleCommitError(). When git.requireGitUserConfig is false, the user config validation is skipped and the actual commit error is surfaced to the user instead.

The rebaseContinue() method continues to use the default requireUserConfig = true behavior since it has no corresponding setting.

Additional context

The commit() method correctly respects the setting by conditionally adding -c user.useConfigOnly=true, but the error handler was independently checking user config and overriding the actual error. This fix aligns the error handling with the commit configuration.

When git.requireGitUserConfig is set to false, handleCommitError still
checks for user.name and user.email configuration on any commit failure,
showing the misleading message 'Make sure you configure your user.name
and user.email in git' even though the user explicitly opted out of this
requirement.

Pass the requireUserConfig flag to handleCommitError and skip the user
config validation when it is false, allowing the actual commit error to
surface instead.

Closes microsoft#194102
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/src/git.ts

@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 26, 2026
@alexr00 alexr00 removed this from the 1.114.0 milestone Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git - git.requireGitUserConfig setting has no effect

3 participants