Skip to content

fix: detect missing git identity and show actionable error in setup#219

Open
kaixinbaba wants to merge 2 commits into
stephengpope:mainfrom
kaixinbaba:fix/issue-178-git-identity
Open

fix: detect missing git identity and show actionable error in setup#219
kaixinbaba wants to merge 2 commits into
stephengpope:mainfrom
kaixinbaba:fix/issue-178-git-identity

Conversation

@kaixinbaba

Copy link
Copy Markdown

Fixes #178

Changes

  • Updated git identity check to verify both user.name AND user.email (previously only checked user.name)
  • Wrapped git commit call in try-catch to detect identity errors
  • Added clear, actionable error message when git identity is not configured

Why This Fix Matters

Previously, if a user had user.name configured but was missing user.email, the setup would silently fail during git commit with no helpful guidance. Now users get clear instructions on how to fix the issue.

@stephengpope stephengpope left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the problem is real and worth fixing. A few notes:

The identity check at the top is the right approach. Checking both user.name and user.email before proceeding, and falling back to the GitHub API, is exactly what should happen here.

One edge case with the check: If user.name succeeds but user.email fails, the catch block tries to set both from GitHub — overwriting a user.name the user already had configured. Consider checking them independently so you only auto-set what's actually missing.

The try-catch around git commit (lines 184-196) should be removed. The identity check above already guarantees git identity is configured by the time you reach the commit — either it was already set, it was set from GitHub, or setup exited. The commit can never fail with "Author identity unknown" after that check passes, so the catch is dead code.

The error messages themselves are great — clear and actionable. Just needs those two adjustments and this is good to go.

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.

Initial Commit fails with no catch when gh identity is unknown

2 participants