在具有共享登录名的实验室机器上工作。不想设置全局 git 配置参数。
git commit --author="username <email>"
这曾经适用于较旧的 git 版本。现在它产生这个错误:
*** 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 'blah@blah.(none)')
有什么想法吗?
最佳答案
如果您只为当前存储库设置 git 配置信息怎么办?
git config user.email "you@example.com"
git config user.name "Your Name"
编辑
根据 OP 评论,一个可能的解决方案是:
GIT_AUTHOR_EMAIL="you@email.com" && GIT_AUTHOR_NAME="Your Name" && git commit
关于git commit --author 在未设置全局时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29685337/