使用单机 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