How can I prevent Git from using the email name for the @ pc-name username instead of a blank one?

Whenever I try to use GIT, it automatically enriches my commits with a lot of personal data, such as username, email address and / or pc-name.

How to configure GIT correctly so that it never automatically reveals my personal data?

I have already completed

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

However, my transactions / pushings contain my account and computer name, which I consider private.

What needs to be done to prevent GIT from posting my personal information to repositories / Internet?

+6
source share
2 answers

Launch

 git config --global user.email "" 

clears the user.email field of your user level configuration file, which will lead to Git to assume that you have not set your email address yet (assuming the email address is not listed at the config file storage level, of course).

As a countermeasure, Git will generate an email address of the form username@pc-name (where pc-name includes the name and fully qualified domain name) and instead prints this email in your commits:

 $ git log -1 commit 9cd00b7ed6206086bf332e0481092590d07626d5 Author: jubobs < jubobs@jubobs-MacBook-Pro.local > Date: Thu Dec 18 16:23:19 2014 +0000 

However, you can use Git to use an empty email address; you just need to run the following command (tested with Git 2.1.3):

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

Then Git will not use the auto-generated email address mentioned above:

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

Related: Git commit without email

+6
source

If the GIT repository belongs to the GitHub project, providing an invalid email address is not recommended. Instead, GitHub indicates the following alternative ( cite GitHub help ):

If you want your email address to be private, set the email address for the Git configuration username@users.noreply.github.com instead, replacing the username with the GitHub username.

+1
source

Source: https://habr.com/ru/post/1209465/


All Articles