`npm init vite-plugin-ssr@latest` logs "fatal" git errors.
See original GitHub issueDescription
When scaffolding a new vite-plugin-ssr
project with npm init vite-plugin-ssr@latest
, the following git errors are logged in the command’s output:
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
error: No such remote 'origin'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
This doesn’t seem to cause any actual issue with git initialization or the first commit. Rather, this seems to be a normal git behavior when committing for the first time in a fresh repository. The error logs on the first commit but then won’t log again on subsequent commits.
However, this behavior is a little noisy in the scaffolding logs, and made me initially wonder if something went wrong with the operation.
As a solution, we could simply prevent the log from making it to the user by passing { stdio: 'ignore' }
in the git-related execSync
options. As far as I can tell, create-react-app uses the same approach to prevent these errors from making it to users.
I’m not sure of another option offhand; there might be something better. If ignoring the output here sounds like an OK path forward to you as well though, I’d be happy to submit a PR with that change.
Error Stack
Included in description
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Ok I see. Yes, PR welcome! Good idea.
Done.