Search code examples
gitgithubgit-commitgit-pushpull-request

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;


Solution

  • 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 = john.doe@example.com
    

    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.