git commit 命令出现“fatal: unable to auto-detect email address (got '******@.(none)')错误

初学者使用git来控制代码版本时,使用git commit 命令是出现fatal: unable to auto-detect email address (got ‘…@…(none)’) 错误,这是由于未配置github用户名和邮箱所致:

$ git commit -m "text commit"

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  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 '...@.....(none)')

解决方法是 配置你的github用户名和和邮箱,邮箱是你github的注册邮箱,用户名是你github的用户名

git config --global user.email "[email protected]"
git config --global user.name "daming-Z"

再次运行,成功

$ git commit -m "text commit"
[master (root-commit) 32dfc26] text commit
 1 file changed, 2 insertions(+)
 create mode 100644 hit.txt

更多内容请参考这篇博客,轻松易懂:史上最简单的 GitHub 教程

猜你喜欢

转载自blog.csdn.net/weixin_44022515/article/details/105967226