GitHub has a setting to protect user privacy by not allowing changes to be pushed to GitHub where author email is one of the ones informed in your Settings.
Given that the git configuration in my development machine is used for work too, global configuration uses my work
email. Because of that, I have to remember configuring the email alias that GitHub uses instead of my real email… And
sometimes I forget to do it. So, when I do a
git push I receive an error.
There’s an easy fix for this, by changing the configuration and then amending the commit like so (my email alias in GitHub is email@example.com):
git config user.email firstname.lastname@example.org git commit --amend --author="Xavier Rubio Jansana <email@example.com>" && git rebase --continue
Improvement on 20.08.2021
From the following answer in StackOverflow, if you need to fix multiple commits, you could do the following:
git config user.email firstname.lastname@example.org git rebase -i YOUR_SHA -x "git commit --amend --author 'Xavier Rubio Jansana <email@example.com>' -CHEAD"
The changes will be applied to all the commits after