You've pushed your code to GitHub/GitLab, but didn't set the correct author's email - what now?

When you take a look at the remote code repository (GitHub, GitLab, or similar), the commit is linked to the wrong user.

Fix single git commit with the wrong email address/user name

  1. Fix the git configuration in your terminal (local):

    git config user.name "Your name"
    git config user.email "your@email.com"
    
  2. Rebase

    git rebase -i HEAD~1
    

    An editor window pops up where the commit is marked as pick - change it to edit and save.

  3. Git Amend

    git commit --amend --reset-author
    
  4. Finish the rebase

    git rebase --continue
    
  5. Push to the remote repository

    git push -f origin master
    

Alternative

You can also work with git filter-branch to fix the complete history.

git filter-branch --env-filter 'export GIT_AUTHOR_EMAIL="correct@email.com";GIT_AUTHOR_NAME="correct name"'
git push -f origin master

Further Reading