Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent Git from using an email of the form username@pc-name instead of an empty one?

Whenever I try to use GIT it automatically enriches my commits with a lot of private data like user name, email and/or pc-name.

How do I configure GIT correctly so that it never automatically discloses my private data?

I already performed

git config --global user.name Robert
git config --global user.email ""

However my commits/pushes still contain my account and computer name which I consider to be private data.

What is necessary to make GIT not to publish my personal information into the repositories/internet?

like image 816
Robert Avatar asked Dec 18 '14 15:12

Robert


1 Answers

Running

git config --global user.email ""

clears the user.email field of your user-level config file, which will lead Git to assume that you haven't set your email address yet (under the assumption that no email address is specified in the repository-level config file, of course).

As a countermeasure, Git will generate an email address of the form username@pc-name (where pc-name includes the name and the FQDN) and will bake that email into your commits instead:

$ git log -1
commit 9cd00b7ed6206086bf332e0481092590d07626d5
Author: jubobs <[email protected]>
Date:   Thu Dec 18 16:23:19 2014 +0000

However, it is possible to trick Git into using an empty email address; you simply need to run the following command instead (tested with Git 2.1.3):

git config --global user.email "\<\>"

Then, Git won't use the autogenerated email address mentioned above:

$ git log -1
commit 0d0bb289b293ec020b607021bbd886be5107bc7f
Author: Jubobs <>
Date:   Thu Dec 18 16:25:14 2014 +0000

Related: Git commit with no email

like image 161
jub0bs Avatar answered Nov 14 '22 03:11

jub0bs