You should stop using --author
each time you commit, and instead configure an author with git config
. Once you've done so, you can type git commit
and the author will be pulled from your .gitconfig
file.
If you want to give --author
a name to use for authoring the commit, you need to use
bob <[email protected]>
not just bob
. If your author string doesn't match the user <[email protected]>
format, Git assumes you've given it a search pattern, and it will try to find commits with matching authors. It will use the first found commit's user <[email protected]>
as the author.
This command will do the trick:
git commit --amend -C HEAD --reset-author
Note: starting with Git 2.3.1+ (Q1/Q2 2015), the error message will be more explicit.
See commit 1044b1f by Michael J Gruber (mjg
):
commit
: reword--author
error message
If an
--author
argument is specified but does not contain a '>
' then git tries to find the argument within the existing authors; and gives the error message "No existing author found with '%s'
" if there is no match.
This is confusing for users who try to specify a valid complete author name.
Rename the error message to make it clearer that the failure has two reasons in this case.
The solution remains to have the config user.name and user.email properly set, but for the case where --author
is used, at least the expected argument is now clearer.
So run:
git add --all ; git commit -m "$git_msg" \
--author "First Last <[email protected]>"; git push
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With