GIT commit as different user without email / or only email

Willem D'Haeseleer picture Willem D'Haeseleer · Jul 20, 2012 · Viewed 131.5k times · Source

I'm trying to commit some changes as a different user, but i do not have a valid email address, following command is not working for me:

git commit --author="john doe" -m "some fix"
fatal: No existing author found with 'john doe'

I have the same problem when trying to commit with only an email address

git commit --author="[email protected]" -m "some fix"
fatal: No existing author found with '[email protected]'

On the GIT man pages for the commit command it says i can use the

standard A U Thor <[email protected]> format

For the --author option.

Where is this format defined ? what does A and U stand for ? how do i commit for a different user with only a username or only an email?

Answer

eykanal picture eykanal · Jul 20, 2012

The minimal required author format, as hinted to in this SO answer, is

Name <email>

In your case, this means you want to write

git commit --author="Name <email>" -m "whatever"

Per Willem D'Haeseleer's comment, if you don't have an email address, you can use <>:

git commit --author="Name <>" -m "whatever"

As written on the git commit man page that you linked to, if you supply anything less than that, it's used as a search token to search through previous commits, looking for other commits by that author.