git: improve error message for remote server failures on push#301115
git: improve error message for remote server failures on push#301115murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When git push fails with 'remote: fatal error in commit_refs', VS Code showed a misleading 'Try running Pull first' message. This error actually indicates a remote server issue (e.g., GitHub outage), not a local integration problem. Added RemoteInternalError code that detects 'fatal error in commit_refs' in the push stderr output and shows a message directing users to check the remote service status page. Fixes microsoft#182679
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
There was a problem hiding this comment.
Pull request overview
Improves the Git extension’s push failure UX by detecting a specific GitHub server-side error (remote: fatal error in commit_refs) and surfacing a more accurate, actionable message instead of suggesting a local “Pull” workaround.
Changes:
- Add a new
GitErrorCodes.RemoteInternalErrorenum value to represent remote server internal failures. - Detect the
fatal error in commit_refspattern fromgit pushstderr and map it toRemoteInternalError. - Show a tailored, user-facing error message for
RemoteInternalErrorthat points users to GitHub Status.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| extensions/git/src/git.ts | Classifies git push failures containing fatal error in commit_refs as RemoteInternalError. |
| extensions/git/src/commands.ts | Adds a dedicated notification message for RemoteInternalError during push operations. |
| extensions/git/src/api/git.d.ts | Extends the public GitErrorCodes enum with RemoteInternalError. |
| case GitErrorCodes.RemoteInternalError: | ||
| message = l10n.t('Can\'t push refs to remote. The remote server encountered an internal error. If using GitHub, check https://www.githubstatus.com/ for details.'); | ||
| break; |
There was a problem hiding this comment.
The githubstatus.com URL is embedded directly in the localized string. Consider using a placeholder (e.g. {0}) and passing the URL as an argument to l10n.t(...) so changing the URL later won’t invalidate existing translations and translators can reposition it as needed.
Problem
When
git pushfails withremote: fatal error in commit_refs(indicating a GitHub server-side issue), VS Code shows the misleading message:This is incorrect because the error is caused by the remote server, not by local changes being out of date. Users waste time pulling and retrying when the actual issue is a GitHub outage.
Fix
Added detection for
remote: fatal error in commit_refspattern in the push error handler. When detected, shows a more helpful message directing users to check the remote service status:Changes
extensions/git/src/api/git.d.ts— AddedRemoteInternalErrortoGitErrorCodesenumextensions/git/src/git.ts— Detectfatal error in commit_refsin push stderr before falling through to genericPushRejectedextensions/git/src/commands.ts— HandleRemoteInternalErrorwith improved error messageTest Plan
remote: fatal error in commit_refsin stderrFixes #182679