6

I have written some instructions that also use git to apply some patches. The instructions are intended to be put into the console and be done with it. Like this:

git am bar.patch
git am foo.patch

But git is now asking for the users name/email:

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@user-VirtualBox.(none)')
You need to set your committer info first

This does not seem to be needed, as only the author of the the patches appear in the git log, but not the one who applied them. Is there a way to ignore configuration?

edit: typos

mwarning
  • 721
  • 5
  • 22
  • 1
    All commits have both an author and committer, there is no way around that. What's wrong with just configuring the user name/email once and being done with it ? – Andrew C Nov 18 '14 at 03:45
  • The problem is that people copy&paste the commands and do not see that git fails to apply the patches (because git is not configured). – mwarning Nov 27 '14 at 03:34

2 Answers2

2

See "Difference between author and committer in Git?"

When you apply a patch, you are the committer. So Git needs to know who "you" are.

Regarding git am, I would recommend considering to use the --committer-date-is-author-date if you want the date associated with those commits created by those patch to be the same as the date recorded in said patches.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The patch is applied to a local repository and ultimately thrown away. I tried to use git am --author "New Author Name " foo.patch, but git does not accept this. Maybe a non-git patch is the solution. – mwarning Nov 27 '14 at 03:50
1

Git checks the GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, and EMAIL environmental variables. This works:

EMAIL=root@localhost git am foo.patch
Margaret
  • 45
  • 5