Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
705 views
in Technique[技术] by (71.8m points)

git - Why github allows unrecognized author to commit

On my own GitHub repository I've noticed that there are commits from unrecognized author.

I've started investigating and I realized that when I push any changes on my remote repository via Visual Studio 2015 - Team Explorer, the changes are pushed successfully even If I change my global .gitconfig settings and set there invalid username along with invalid e-mail address - this is the case when I get unrecognized author.

If I try to push the changes directly via git bash command prompt, and enter invalid username or password I'll get: invalid username or password - which is obvious, and normal.

And I get: The requested URL returned error: 403 if I enter valid user/pass - but again, this is normal because I haven't added this user as my Collaborator. If I add this user as my collaborator, I can push successfully.

So, why is this happening ?

Why GitHub allows me to push changes via VS 2015 with invalid user/email ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Fundamentally, git is decentralized. Every copy of the repository is equal to every other. Commits can go from anywhere to anywhere. It's perfectly normal for you to pull commits from remote X and push them to remote Y, and when they show up on remote Y, the original committer's name will still be on them even though that person may not have an account on remote Y.

Remote Y (github in this case) therefore can't refuse a push just because it contains some unrecognized committer names.

When you authenticate from the command line, you're not entering a username and password to identify yourself as the author of the commits being pushed. You're just identifying yourself as someone who has permission to put those commits in the repository. Presumably when you do it from the IDE, it is using your github credentials which you have entered at some point.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...