tags:

views:

267

answers:

3

The guides I've read so far on Git say that I should go into the config and specify my name and my e-mail address. They don't elaborate; they just say to do it.

Why does Git need my e-mail address? And, more importantly, if I make my repo publicly available, via GitHub for example, will my e-mail address be visible to everyone (including spambots)?

+7  A: 

Git uses your email address to identify you, as well as do other tasks (such as sign a tag with a GPG key). Your email address does get embedded as part of your identity in commit logs, etc., along with the name you specify. For example, the "author" field in a commit log would show up as:

Author: Joe White <[email protected]>

So the information is available to anyone with a copy of the repo, since it acts as an identifier.

Your email probably won't be visible to spambots, though, unless you use Gitweb, or a service like GitHub, to make your repo available through a web interface (merely putting it on the Internet doesn't do this).

I suppose you could fill in a fake email address or use an empty string or space or something (I don't think Git checks the format or validity of the email), but the email is useful if someone who clones the repo needs to send you a patch or contact you in some way.

mipadi
Arguably github, gitweb et al should have an option for obscuring email addresses just like mailing list archive viewers do. Although it being a valid email address is just a convention, tools like 'git send-email' are written assuming that it's true (automatically cc'ing patch authors, for instance)
araqnid
You can configure git to use other identity that the one given by user.name and user.email for GPG key for signing tags
Jakub Narębski
Older centralized version control systems use "username" for identifying author of a commit (of a change). Name + email is good identity; it doesn't need to be real email though.
Jakub Narębski
+1  A: 

Yes, your email address (as specified in git config user.email) will be visible in web interfaces like GitWeb. Also everybody can learn your email address by cloning your repository though this is probably still far beyond spambots. Nobody forces you to use a real email address, though. Git will automatically set a constructed email address if none is given. On my machine without user.email it shows commits by “Foo <foo@daughter.(none)>”.

Bombe
+1  A: 

Yes, the above answers are correct ... except you want to typically have the same email address for all your projects then you would use the command:

git config --global user.email "[email protected]"

You can also edit the .gitconfig file in your home directory, in the user section.

You can specify a different email for a particular project by doing the same command without the global option.

Also, I suggest that you can obfuscate your email if the submits are going to a public area:

briancolfer(at)comcast.net

As an example.

bcolfer