Skip to content

fix(cli): skip initial commit when git user.name or user.email is not set#285

Open
gonzoblasco wants to merge 1 commit into
akd-io:developfrom
gonzoblasco:fix/231-git-crash-no-user-name-email
Open

fix(cli): skip initial commit when git user.name or user.email is not set#285
gonzoblasco wants to merge 1 commit into
akd-io:developfrom
gonzoblasco:fix/231-git-crash-no-user-name-email

Conversation

@gonzoblasco

Copy link
Copy Markdown

What

Fixes #231

The CLI was crashing when trying to run git commit --amend without git user.name or user.email configured. This happened because isGitInitialized only checks for the existence of .git/, not whether git identity is properly set up.

Why

Create Next App may succeed at initializing git (creating .git/) but the subsequent git commit --amend from CNS fails if the user hasn't configured their git identity. This is common in CI/CD environments and fresh setups.

create-next-app handles this gracefully, so CNS should too.

How

  • Added hasGitUserConfig helper that checks both user.name and user.email via git config
  • If either is missing, the initial commit step is skipped with a warning message instructing the user how to configure them
  • The check uses git config user.name (without --global) so it works with both global and local config

Testing

  • tsc --noEmit passes
  • Unit tests pass (pnpm test:cli)
  • The fix follows the same pattern as the existing isGitInitialized check

… set

Fixes akd-io#231

The CLI was crashing when trying to  without
git user.name or user.email configured. This happened because
 only checks for the existence of ,
not whether git identity is properly configured.

Added  helper that checks both
and  via . If either is missing, the
initial commit step is skipped with a warning message instructing
the user how to configure them.
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

@gonzoblasco is attempting to deploy a commit to the 9ty Team on Vercel.

A member of the Team first needs to authorize it.

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.

CLI crashes if git username and email isn't specified

1 participant