首页 > 解决方案 > 当我写 git commit -m "Complete chapter 1" 它不工作

问题描述

cd Desktop
mkdir Story
cd Story
touch chapter1.txt
atom .
git init
git add chapter1.txt
git status
git commit -m "complete chapter 1"

它向我显示此错误消息:

***请告诉我你是谁。

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

设置您帐户的默认身份。

省略 --global 以仅在此存储库中设置身份。

致命:无法自动检测电子邮件地址(得到“Hi@DESKTOP-EL5QS59.(none)”)

标签: gitgit-bashgit-commit

解决方案


git需要知道提交更改的用户的信息。此消息表明您尚未在 git 中配置您的详细信息。

正如@Amadan 提到的,它告诉您错误中的所有内容。您只需要运行以下两个命令:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

替换your@example.com为您的电子邮件和Your Name您的姓名并运行这些命令。您将能够提交更改。

有关更多详细信息,您可以访问 GitHub 的指南:


推荐阅读