asdf-vm / asdf-vm/asdf-plugin-template

Plugin creation fails if git user.email is not configured

Open
#48 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
134
Forks
54
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

If git's `user.email` option is not set, plugin creation fails.

**Steps to reproduce**

1. Clone a repo without the git's global `user.name` option configured (you can temporarily rename `~/.gitconfig` to achieve this effect)
1. Run `bash setup.bash`
1. Observe the error messages at the end (just before the TODO issues are shown).

**Expected behavior**

If the `user.email` option is not set, the script should ask for one.

**Screenshots**

```
william@t450s: ~/asdf-mytool-plugin$ git config -l
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:wpyoga/asdf-mytool-plugin.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
william@t450s: ~/asdf-mytool-plugin$ bash setup.bash
Name for your plugin, starting with `asdf-`, eg. `asdf-foo`
> asdf-mytool-plugin

Shell command for testing correct tool installation. eg. `foo --version` or `foo --help`
[mytool-plugin --help] >

Your GitHub username
> my-github-username

Your name
> My Real Name

The tool's GitHub homepage.
[https://github.com/my-github-username/mytool-plugin] >

The tool's documentation homepage if necessary.
[https://github.com/my-github-username/mytool-plugin] >

Please choose a LICENSE keyword.
See available license keywords at
https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository#searching-github-by-license-type
License keyword:
mit/[apache-2.0]/agpl-3.0/unlicense >

Setting up plugin: asdf-mytool-plugin

author: My Real Name
plugin repo: https://github.com/my-github-username/asdf-mytool-plugin
license: https://choosealicense.com/licenses/apache-2.0/

mytool-plugin github: https://github.com/my-github-username/mytool-plugin
mytool-plugin docs: https://github.com/my-github-username/mytool-plugin
mytool-plugin test: `mytool-plugin --help`

After confirmation, the `main` will be replaced with the generated
template using the above information. Please ensure all seems correct.
Type `yes` if you want to continue.
> yes

Already on 'template'
Preparing worktree (detached HEAD e518561)
HEAD is now at e518561 Initial commit
Switched to a new branch 'out'
rm '.gitlab-ci.yml'
rm '.gitlab/issue_templates/Bug_Report.md'
rm '.gitlab/issue_templates/Feature_Request.md'
rm '.gitlab/merge_request_templates/Merge_Request.md'
rm 'README-gitlab.md'
rm 'contributing-gitlab.md'

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'william@t450s.(none)')
error: refname refs/heads/out not found
fatal: Branch rename failed
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
All done.
Your main branch has been reset to an initial commit.
Push to origin/main with `git push --force-with-lease`
Review these TODO items:
```

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with setup.bash and reproduce the issue after temporarily removing the Git configuration, using the shown command sequence. Trace the final Git operations after confirmation and verify that setup prompts for a missing user.email and completes without the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, git
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.