1. 程式人生 > >單機使用git, commit 提交時報錯

單機使用git, commit 提交時報錯

開發十年,就只剩下這套架構體系了! >>>   

使用單機 git 時,

  git  add  1.txt         新增檔案到 git 倉庫,使用 git  commit  -m "add 1.txt" 提交時報錯如下:

[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 "[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 'root@localhost_02.(none)')

那麼怎麼如理:其實上圖例報錯已經很明顯了; 
  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

執行這兩條命令,再次提交即可;

[root@localhost_02 gitroot]#  git config --global user.email "[email protected]"
[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