Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the author of a commit in GitHub?

I want to know if there is a way to change the person(account) who pushed changes in a GitHub repository.

For example: I push to my private repository under a different name(not email) but I misspell one letter of my name and GitHub marks the commit as commited by userame not username;

like image 813
Karina Kozarova Avatar asked May 26 '17 14:05

Karina Kozarova


People also ask

How do you change the name of a commit?

On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit.


1 Answers

I suggest you to fix the committer. Remember that there is a difference between the user who commit, and the committer. The committer is signed inside .git/config folder:

$ cat .git/config
[user]
    name = John Doe
    email = [email protected]

Now, you just need to git commit --amend and git push origin BRANCH -f. The former command commit again (but this time with the committer updated). The latter, overwrite the branch.

like image 52
sensorario Avatar answered Sep 21 '22 10:09

sensorario