victorsun
victorsun

Reputation: 11

Using git: when asking for user.email, you can put any email?

I'm new to understanding git, and one of the first things you do to configure your git are

$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Name"

It turns out, you can put any email in, and once you commit and push your files into Github, Github somehow finds the user associated with the email and claims it is this user that did the commmit in the in the repo's history. How does this make sense if you can't even verify that git email is actually you.

However, I understand that before you can push anything, you need to confirm through Github user and password that you can access rights to the repo, so in the big scheme, it won't affect much, other than the author's claim in the commit history.

Upvotes: 1

Views: 421

Answers (1)

phd
phd

Reputation: 95120

How does this make sense if you can't even verify that git email is actually you.

Because you're allowed to push commits on behalf of any other users. Example workflow:

  • You create one or few commits in master branch.
  • You pull a few commits into the master branch from an upstream repository. These commits have been created by another user or users.
  • You push the master branch to origin. Please note you push many commits including those that were not created by you and origin — whatever it is — must accept all of them. Hence there is no email verification.

If you want to authenticate commits you can digitally sign them using OpenPGP.

Upvotes: 1

Related Questions