You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Email validation rejects valid addresses with hyphenated domain labels #360
Tried upgrading to the latest git-mob version (npm i -g git-mob)
Tried upgrading to the latest git version (brew upgrade git if installed with Homebrew/Linuxbrew)
Description
git add-coauthor rejects valid email addresses whose domain labels contain hyphens (e.g., kyushu-u.ac.jp, example-corp.com) with the error Invalid email format..
Hyphens in domain labels are allowed by RFC 1035 2.3.1, so these addresses should be accepted.
Steps to Reproduce
Run git add-coauthor tu "Test User" user@kyushu-u.ac.jp
Observe the error message
Expected behavior: The coauthor with the hyphenated domain email is added to .git-coauthors.
Actual behavior: The command fails with Invalid email format. and nothing is written to .git-coauthors.
Reproduces how often: 100%
Versions
operating system and version: macOS Tahoe 26.4
git-mob version (git-mob --version): 4.0.1
git version (git --version): 2.53.0
Additional Information
The validateEmail function in packages/git-mob/src/helpers.ts uses the regex (\w+\.)+[a-zA-Z]{2,} for the domain portion of an email address.
JavaScript's \w is [A-Za-z0-9_] and does not include -, so this pattern fails to match any label that contains a hyphen.
I work around this by registering with a dummy address (e.g., xxx@gmail.com) and then manually editing .git-coauthors (path: git mob -p) to replace it with the actual address.
Suggested fix (accepts - and rejects _ in the domain part, since _ is not valid in DNS labels per RFC 1035):
Activity
rkotze commentedon Apr 10, 2026
@noshita thanks for raising the issue and investigating where the problem is.