3

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

5 Answers 5

6

run following commands in terminal

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


git config --global user.name "Ur github Username"
Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

1

Despite setting user and email in config, it continued to use the system account name until this:

git config user.useConfigOnly true

user.useConfigOnly Instruct Git to avoid trying to guess defaults for user.email and user.name, and instead retrieve the values only from the configuration. For example, if you have multiple email addresses and would like to use a different one for each repository, then with this configuration option set to true in the global config along with a name, Git will prompt you to set up an email before making new commits in a newly cloned repository. Defaults to false.

Comments

0

Adding to Tilak's answer, you may also have to re-define local config values if they have already been declared. Execute the following within whatever repo you are currently working:

git config user.email "[email protected]"
git config user.name "name"

If you already tried changing the local user.name config value within your current repo it will overwrite the global value. So when you execute git config -l you could see duplicate user.name and user.email values. If both exist, then make sure they are both defined how you want them.

Comments

-1
git config --global user.email "your Email"    

git config --global user.name "you GitHub ID"

2 Comments

While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply
This is an exact duplicate of the accepted answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.