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 ?

- 2,706
- 1
- 15
- 22
-
Are you really doing this manually? Why not write a script to do all the hard work? – Sep 10 '11 at 16:23
-
Yes I am. Since svn cannot rebase multiple commits into single ones, I have to merge some commits during my conversion process, which is hard to do with script since it requires my inspection. I also translate the comments into english and format it for git (50 characters title...). So I have to do it by hand if I want it to be well done. – neodelphi Sep 10 '11 at 16:28
-
1Possible duplicate of [Commit without setting user.email and user.name](http://stackoverflow.com/questions/22058041/commit-without-setting-user-email-and-user-name) – Ciro Santilli OurBigBook.com Oct 14 '15 at 09:12
-
Possible duplicate of [git commit as different user without email / or only email](https://stackoverflow.com/questions/11579311/git-commit-as-different-user-without-email-or-only-email) – Yep_It's_Me May 29 '19 at 01:30
4 Answers
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.

- 755,051
- 104
- 632
- 656
-
Wanted to set it up in user.name but it does not work. Only in command line. – neodelphi Sep 10 '11 at 16:46
-
15Ok, every think now works ! Had to set: `git config --global user.name "Snail Mail"` `git config --global user.email \<\>` < and > escaped because I use bash. Thx again for your reply. – neodelphi Sep 10 '11 at 16:56
-
Some tools complain when having empty email fields. Wasn't it git rebase -i? – koppor Dec 23 '12 at 13:06
-
3Does not work at all, I receive the same messages as without --author. – Szczepan Hołyszewski May 01 '17 at 18:51
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 '<>'

- 1,581
- 1
- 19
- 29
Use GitHub Anonymous NoReply Email (recommended)
When contributing to github, always use the anonymous noreply email address provided by github - which you can find here: https://github.com/settings/emails (have to tick "Keep my email addresses private" to see it).
If using github or even if you're not, this is a better option than setting no email.
git config user.name 'Joe Blogs'
git config user.email 'ID+username@users.noreply.github.com'
Or you can add this to your ${repo}/.git/config
or .gitconfig
file directly;
[user]
name = Joe Blogs
email = ID+username@users.noreply.github.com
Set invalid email (not recommended)
Otherwise you can fallback to the other options people have stated;
git config user.name 'Joe Blogs'
git config user.email '<>'
Or you can add this to your ${repo}/.git/config
or .gitconfig
file directly;
[user]
name = Joe Blogs
email = <>

- 91
- 1
- 1
I had same issue . But now I can fix it by using github no reply mail .
Go to https://github.com/settings/email and copy your no reply mail ,it would look like this ID+username@users.noreply.github.com
.
than set this email as global email to your pc :
git config user.email 'ID+username@users.noreply.github.com
After this process your problem will fix

- 1
- 3