首页 > 代码库 > [Git]Git未初始化导致的错误提示

[Git]Git未初始化导致的错误提示

业务场景:使用git提交readme.txt文件,结果出现如下提示:

[pms@yhd-jqhadoop39 /home/pms/workspace/ouyangyewei/learngit]
$git commit -m 'add readme.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: empty ident name (for <pms@yhd-jqhadoop39.int.yihaodian.com>) not allowed

原因:如上述提示,git未设置用户信息

解决方法:设置user.email和user.name即可

$git config --global user.name "ouyangyewei"
$git config --global user.email "ouyangyewei@yhd.com"
[pms@yhd-jqhadoop39 /home/pms/workspace/ouyangyewei/learngit]
$git config --list
user.name=ouyangyewei
user.email=ouyangyewei@yhd.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
[pms@yhd-jqhadoop39 /home/pms/workspace/ouyangyewei/learngit]
$ls
readme.txt

[pms@yhd-jqhadoop39 /home/pms/workspace/ouyangyewei/learngit]
$git commit -m 'add readme.txt'
[master (root-commit) 3e48caa] add readme.txt
 1 file changed, 2 insertions(

[Git]Git未初始化导致的错误提示