Do not mandate global git config - #518
Merged
Merged
Conversation
The pre_gen hook checked `git config user.name`/`user.email` with check=True before the project repo existed, so it only read the *global* git config. Users who configure git per-repository have no global identity and hit an opaque CalledProcessError that aborted generation. Resolve the author identity with a fallback chain instead: prefer an existing git config (global or system), otherwise fall back to the cookiecutter `author_full_name`/`author_email` answers. The resolved identity is written to the repo-level config only when not already available, so we never clobber the user's real git identity, and the initial commit succeeds either way. Fail cleanly with an actionable message if no identity can be determined. Add a regression test that generates the template with the global/system git config neutralized and asserts the initial commit is authored by the cookiecutter answers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
A PR has been generated to the instance repo: scverse/cookiecutter-scverse-instance#290 You can check out the PR to preview your changes in an instance of the cookiecutter template. |
flying-sheep
approved these changes
Jun 25, 2026
This was referenced Jul 17, 2026
This was referenced Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #389
@gtca, this is to address an issue you flagged a while ago about the cookiecutter template not working without a global git config.
Now, if no global git config is available, it would set
user.nameanduser.emailbased on the values the user provided to the cookiecutter prompt. Is this in line with what you'd expect?