Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git commit with no email

Tags:

git

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 ?

like image 258
neodelphi Avatar asked Sep 10 '11 16:09

neodelphi


People also ask

Can I use git without email?

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.

Can you git commit without a message?

Git does not recommend to commit without any message. Moreover, you won't be able to track down these changes once you see the history.

How do I hide my email address in GitHub?

You can get an ID-based noreply email address for GitHub by selecting (or deselecting and reselecting) Keep my email address private in your email settings.


2 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.

like image 82
CB Bailey Avatar answered Sep 19 '22 04:09

CB Bailey


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 '<>' 
like image 32
Sparhawk Avatar answered Sep 20 '22 04:09

Sparhawk