-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gatsby new fails if there's no git identity set #17766
Comments
Thanks for opening the issue! It would probably be best in this case then if the CLI bails the commit and removes |
I've just discovered a workaround: need to set the
It's not very ergonomic, but it works. |
Hey @zeorin, |
For anyone who would like to work on this: gatsby/packages/gatsby-cli/src/init-starter.js Lines 83 to 92 in ffeed10
It would be great if we could determine if git identity is set before doing |
Git could possibly fail for other reasons though, not just because of a missing identity. |
Yeah, you are right about this - we should definitely have generic error handling there, to at least not crash. I still think having special case for missing git identity could be valuable - maybe we would want to skip initializing git repo at all if email is not set (so we bail on all git actions and don't have to rollback some of them). I think it's easier for users (specifically users new to git) - this way as they wouldn't have to figure out how to dig out of whatever git status is left with and they could follow whatever tutorial showing up how to init repository, make initial commit, etc. As you said, commit can fail for multiple reasons and it's unlikely we would have special cases for all of them (or even know about all possibilities), but catching common ones early would make better user experience (IMO) |
@pieh We could try catch the whole git process if it fails we |
Sure, let's do that ;) I was probably overthinking this |
if this is skipped a info message should be printed to console ... |
@siddhant1 I want to take this, but can't assign myself to it (probably because I'm not listed as an contributor) |
Is this taken? |
@kcurtet is working on this! |
here it is already removed before... so not mind my comment gatsby/packages/gatsby-cli/src/init-starter.js Lines 177 to 183 in d2345b6
|
Description
gatsby new
fails if there's no git identity set.I don't set my
email
in~/.gitconfig
on purpose, as then I am asked to set it on the 1st commit for every new local clone (withgit config --global user.useConfigOnly true
). I need to use different email addresses for different projects and I always forget to set it correctly unless I don't set my email globally.I would love it if there were a way to skip the git commit part of setting up a new project.
Steps to reproduce
Unset your git identity (open
~/.gitconfig
, removeemail
line in section[user]
, in the same section add lineuseConfigOnly = true
, and then run e.g.gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
.Expected result
Set up a gatsby project.
Actual result
Environment
The text was updated successfully, but these errors were encountered: