1、起因

重装完系统后,生成ssh密钥并添加到github中后,使用git来提交代码时,使用git commit 命令时出现fatal: unable to auto-detect email address (got ‘…@…(none)’) 错误,如下面:

$ git commit -m "2023-03-24"

*** 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 '...@.....(none)')

2、原因

这是由于未配置github用户名和邮箱所致,我们配置一下github用户名和和邮箱就可以解决了,邮箱是你github的注册邮箱,用户名是你github的用户名

git config --global user.email "XXXXXXX@163.com"

git config --global user.name "XXXXXX"

再次运行,就可以成功提交

$ git commit -m "2023-03-24"

[master (root-commit) 32dfc26] text commit

1 file changed, 2 insertions(+)

create mode 100644 hit.txt

参考文章

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: