Why github allows an unrecognized author to commit

In my own GitHub repository, I noticed there are commits from unrecognized author

.

I started researching and I realized that when I push any changes to the remote repository through Visual Studio 2015 - Team Explorer

, the changes will be successfully pushed. If I change my global settings .gitconfig

and set an invalid username there along with an invalid e-mail address - this is the case where I get unrecognized author

.

If I try to push changes directly from the command line git bash

and enter the wrong username or password, I get: invalid username or password

- this is obvious and ok.

And I get: The requested URL returned error: 403

if I enter the correct user / password, but again, that's ok because I haven't added this user as mine Collaborator

. If I add this user as my collaborator, I can successfully push.

So why is this happening?

Why is GitHub allowing me to inject changes through VS 2015 with an invalid user / email?

+3


source to share


1 answer


Basically, git is decentralized. Each copy of the repository is equal to any other. Records can move from anywhere to another. It is perfectly normal for you to pull commits from remote X and direct them to remote Y, and when they show up on remote Y, the original committer name will still be on them, even if that person may not have an account on remote Y.

Remote Y (github in this case) therefore cannot refuse to push just because it contains some unrecognized committer names.



When you authenticate from the command line, you do not enter your username and password to identify yourself as the author of the commits you are making. You simply identify yourself as the person who has permission to push those commits to the repository. Presumably when you do this from the IDE, it uses your github credentials that you entered at some point.

+3


source







All Articles