git commit --author 在未设置全局时不起作用

标签 git

在具有共享登录名的实验室机器上工作。不想设置全局 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/

相关文章:

git - Git merge 冲突后,很多我没碰过的文件变成了要提交的更改

git - 如何防止git跟踪新分支到父本地分支?

git/gitolite : moving repos after setting up gitolite

node.js - 我是否提交由 npm 5 创建的 package-lock.json 文件?

git - 有没有办法比较 2 个未 rebase 的 git 分支?

git - 与 git branch --set-upstream 相反

objective-c - 什么是 ObjectiveC.gcno?它应该包含在源代码存储库中吗?

Git format-patch输出在单个文件中

git - 推送后重做错误的 git 冲突解决

java - 通过 Java 使用用户名和密码通过 ssh 克隆 git 存储库