Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - MacOS user is commit author instead of Github user

Tags:

git

github

I just switched to OS X and did my first commit. After pushing to Github the commit author was not my Github username but the current user on my laptop. The commit author appears as "non-author". I want the commit author to be my Github username like before. What should I do to fix it? Here is a photo of what I mean: https://i.sstatic.net/LLEph.png

like image 300
Georgi Slaveykov Avatar asked Apr 29 '26 12:04

Georgi Slaveykov


2 Answers

run following commands in terminal

git config --global user.email "Ur GitHub email"


git config --global user.name "Ur github Username"
like image 120
Tilak Putta Avatar answered May 02 '26 09:05

Tilak Putta


While Tilak's answer solves your problem, it doesn't tell you why. This answer is mainly for this purpose.

First thing is: GitHub and Git ARE NOT the same thing.

This is a common mistake. Git is the versioning management tool, while GitHub is a service which provides a Git server on the cloud. Others include Bitbucket and GitLab.

Second thing is:

The default user for commits is the one you run git with. So if, for instance, you executed sudo git commit, the user would be root. What you need to do is, as the accepted answer suggests, configure the username you want, which has nothing to do with your GitHub account, it could be any name.

Third thing is:

The non-author issue is due to the fact that GitHub matches the email of the user that created the repository ON THEIR SIDE and the email of the committer, again, configurable by means of the accepted answer's suggestion. But, your Git user.email configuration has nothing to do, again, with GitHub. It's just used to differentiate repository creator's commits from collaborator's commits.

like image 25
Patrick Villela Avatar answered May 02 '26 11:05

Patrick Villela