Git commit with no email

2020-03-08 09:15发布

I'am currently converting a svn repository into a git one. As I proceed manually, I regularly change the user.name and user.email to set the author of the commit. Everything seems to work fine, but now I have to commit something from a user which has no email address. I removed email property from .gitconfig file and tried, but then in git log, email field shows user_login@user_login.(none). Is it possible to set no email and prevent git guessing one ?

标签: git
3条回答
家丑人穷心不美
2楼-- · 2020-03-08 09:44

Similar to neodelphi's comment, you can set this for all commits with

git config --global user.name 'Snail Mail'
git config --global user.email '<>'

(You can use quotes instead of escaping.) To set this for the current project only, remove the --global option only. i.e.

git config user.name 'Snail Mail'
git config user.email '<>'
查看更多
Luminary・发光体
3楼-- · 2020-03-08 09:46

the accepted answer doesn't work on some git versions (including, but not limited to mine (@Szczepan Hołyszewski @xiaodai) )

this answer worked for me

查看更多
兄弟一词,经得起流年.
4楼-- · 2020-03-08 10:06

I think that you can only do this with an explicit author specification:

git commit --author "Snail Mail <>"

You need the angle brackets so that git knows that you really are passing an empty email address.

查看更多
登录 后发表回答