使用單機 git 時,git
用 git add 1.txt 添加文件到 git 倉庫,使用 git commit -m "add 1.txt" 提交時報錯以下:bash
[root@localhost_02 gitroot]# git add 1.txt [root@localhost_02 gitroot]# git commit -m "add 1.txt" *** 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 'root@localhost_02.(none)')
那麼怎麼如理:其實上圖例報錯已經很明顯了;
git config --global user.email "you@example.com"
git config --global user.name "Your Name"ide
運行這兩條命令,再次提交便可;this
[root@localhost_02 gitroot]# git config --global user.email "yyy@163.com" [root@localhost_02 gitroot]# git config --global user.name "yuanhhhhh" [root@localhost_02 gitroot]# git commit -m "add 1.txt" [master(根提交) 90c3021] add 1.txt 1 file changed, 5 insertions(+) create mode 100644 1.txt