Git fatal: unable to auto-detect email address

问题描述

废话较多,看方法的直接跳转到最后。按照廖雪峰的Git教程在Windowns上配置git,并编辑文件进行提交时,出现以下错误提示:

** 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 'lvyp@NEU-20190128LYP.(none)')

意思是说你在创建本地仓库时未定义用户名和邮箱,此时再按照错误提示,利用

git config --global user.name "follow"
git config --global user.email "follow@qq.com"

进行用户名和密码配置发现并不管用。百度到的方法全是说:

找到工程目录的.git文件夹,打开之后找到config文件,在最后边加上一句话
[user]
 email=your email
 name=your name

这种方法我没有实验,因为在对Git研究不够深的情况下,贸然进行修改配置文件的操作,我是拒绝的。

还有说配置完

git config --global user.name "follow"
git config --global user.email "follow@qq.com"

再跟上一句

git config --local -l

追加的指令只是用来看本地配置的,根本不能解决问题。因此回顾创建仓库的步骤,发现是建库初期缺失了一个步骤。

问题解决

按照教程中所说:

在安装完Git时就应该定义用户名和密码,如果忘记了,等创建完仓库后重新设置就会出现上述所述问题。

本人的解决方法:

1、删除本地仓库;
2、配置用户名和密码
	git config --global user.name "follow"
	git config --global user.email "follow@qq.com"
3、重新创建本地仓库,并编辑提交文件:
	mkdir learngit
	cd learngit
	git init
	vi readme.txt
	git add readme.txt
	git commit -m "add a file"

当然此办法治标不治本,具体的原因我也不是很清楚,但是暂时解决了问题,待进一步学习后再研究合适的解决办法。

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值