blob: d842cb7882907a072c7c29a0a2be5acf2df92ee9 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= invalid author
Edwin Kempin9b34e352010-12-23 07:36:31 +01003
David Pursehouse221d4f62012-06-08 17:38:08 +09004For every pushed commit Gerrit verifies that the e-mail address of
Edwin Kempin9b34e352010-12-23 07:36:31 +01005the author matches one of the registered e-mail addresses of the
6pushing user. If this is not the case pushing the commit fails with
David Pursehousec6fd5a62012-06-26 13:42:11 +09007the error message "invalid author". This policy can be
Fredrik Luthanderb295eea2011-12-27 13:40:43 +01008bypassed by having the access right
9link:access-control.html#category_forge_author['Forge Author'].
Edwin Kempin9b34e352010-12-23 07:36:31 +010010
11This error may happen for two reasons:
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010012
13. incorrect configuration of the e-mail address on client or server side
14. missing privileges to push commits of other authors
Edwin Kempin9b34e352010-12-23 07:36:31 +010015
16
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080017== Incorrect configuration of the e-mail address on client or server side
Edwin Kempin9b34e352010-12-23 07:36:31 +010018
David Pursehousec6fd5a62012-06-26 13:42:11 +090019If pushing to Gerrit fails with the error message "invalid author"
20and you are the author of the commit for which the push
Edwin Kempin9b34e352010-12-23 07:36:31 +010021fails, then either you have not successfully registered this e-mail
22address for your Gerrit account or the author information of the
23pushed commit is incorrect.
24
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080025=== Configuration of e-mail address in Gerrit
Edwin Kempin9b34e352010-12-23 07:36:31 +010026
27Check in Gerrit under 'Settings -> Identities' which e-mail addresses
David Pursehouse221d4f62012-06-08 17:38:08 +090028you've configured for your Gerrit account. If no e-mail address is
Edwin Kempin9b34e352010-12-23 07:36:31 +010029registered go to 'Settings -> Contact Information' and register a new
30e-mail address there. Make sure you confirm your e-mail address by
31clicking on the link in the e-mail verification mail sent by Gerrit.
32If you don't receive the e-mail verification mail it might be that it
33was caught by your spam filter.
34
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080035=== Incorrect author information
Edwin Kempin9b34e352010-12-23 07:36:31 +010036
37For every commit Git maintains the author. If not explicitly
38specified Git computes the author on commit out of the Git
39configuration parameters 'user.name' and 'user.email'.
40
41----
42 $ git config -l
43 ...
44 user.name=John Doe
45 user.email=john.doe@example.com
46 ...
47----
48
49A commit done with the above Git configuration would have
50"John Doe <john.doe@example.com>" as author.
51
52You can see the author information for existing commits in the
53history.
54
55----
56 $ git log
57 commit cbe31bdba7d14963eb42f7e1e0eef1fe58698c05
58 Author: John Doe <john.doe@example.com>
59 Date: Mon Dec 20 15:36:33 2010 +0100
60
61 my commit
62
63----
64
65Check in Git that the author information of the commit that should
66be pushed is correct. The author should have the same e-mail address
67that you've configured for your Gerrit account. If the author
68information is incorrect set the Git configuration parameters
69'user.name' and 'user.email' to the correct values (you might want to
70set this globally by including the option '--global'):
71
72----
73 $ git config user.name "John Doe"
74 $
75 $ git config user.email john.doe@example.com
76 $
77----
78
79Now you should update the author for those commits where the author
80information is wrong. If only the last commit is affected you can do
81this by amending the last commit and explicitly setting the author:
82
83----
84 $ git commit --amend --author "John Doe <john.doe@example.com>"
85----
86
87If you need to update the author information for several commits it
88gets more complicated. In this case you have to do an interactive
89git rebase for the affected commits. While doing the interactive
90rebase you have to choose 'edit' for those commits for which the
91author should be rewritten. When the rebase stops at such a commit
David Pursehouse221d4f62012-06-08 17:38:08 +090092you have to amend the commit, explicitly setting the author
Edwin Kempin9b34e352010-12-23 07:36:31 +010093before continuing the rebase.
94
Shawn O. Pearce392ef852011-10-11 10:50:36 -070095Here is an example that shows how the interactive rebase is used to
Edwin Kempin9b34e352010-12-23 07:36:31 +010096update the author for the last 3 commits:
97
98----
99 $ git rebase -i HEAD~3
100
101 edit 51f0d47 one commit
102 edit 7299690 another commit
103 edit 304ad96 one more commit
104
105 Stopped at 51f0d47... one commit
106 You can amend the commit now, with
107
108 git commit --amend
109
110 Once you are satisfied with your changes, run
111
112 git rebase --continue
113
114 $ git commit --amend --author "John Doe <john.doe@example.com>"
115 [detached HEAD baea1e4] one commit
116 Author: John Doe <john.doe@example.com>
117 1 files changed, 4 insertions(+), 1 deletions(-)
118
119 $ git rebase --continue
120
121 ...
122----
123
124For further details about git rebase please check the
Marian Harbach34253372019-12-10 18:01:31 +0100125link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[Git documentation,role=external,window=_blank].
Edwin Kempin9b34e352010-12-23 07:36:31 +0100126
127
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800128== Missing privileges to push commits of other users
Edwin Kempin9b34e352010-12-23 07:36:31 +0100129
David Pursehousec6fd5a62012-06-26 13:42:11 +0900130If pushing to Gerrit fails with the error message "invalid author"
131and somebody else is author of the commit for which the
Edwin Kempin9b34e352010-12-23 07:36:31 +0100132push fails, then you have no permissions to forge the author
133identity. In this case you may contact the project owner to request
134the access right '+1 Forge Author Identity' in the 'Forge Identity'
135category or ask the maintainer to commit this change on the author's
136behalf.
137
138
139GERRIT
140------
141Part of link:error-messages.html[Gerrit Error Messages]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700142
143SEARCHBOX
144---------