Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 2 | = invalid author |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 3 | |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 4 | For every pushed commit Gerrit verifies that the e-mail address of |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 5 | the author matches one of the registered e-mail addresses of the |
| 6 | pushing user. If this is not the case pushing the commit fails with |
David Pursehouse | c6fd5a6 | 2012-06-26 13:42:11 +0900 | [diff] [blame] | 7 | the error message "invalid author". This policy can be |
Fredrik Luthander | b295eea | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 8 | bypassed by having the access right |
| 9 | link:access-control.html#category_forge_author['Forge Author']. |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 10 | |
| 11 | This error may happen for two reasons: |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 12 | |
| 13 | . incorrect configuration of the e-mail address on client or server side |
| 14 | . missing privileges to push commits of other authors |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 15 | |
| 16 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 17 | == Incorrect configuration of the e-mail address on client or server side |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 18 | |
David Pursehouse | c6fd5a6 | 2012-06-26 13:42:11 +0900 | [diff] [blame] | 19 | If pushing to Gerrit fails with the error message "invalid author" |
| 20 | and you are the author of the commit for which the push |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 21 | fails, then either you have not successfully registered this e-mail |
| 22 | address for your Gerrit account or the author information of the |
| 23 | pushed commit is incorrect. |
| 24 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 25 | === Configuration of e-mail address in Gerrit |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 26 | |
| 27 | Check in Gerrit under 'Settings -> Identities' which e-mail addresses |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 28 | you've configured for your Gerrit account. If no e-mail address is |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 29 | registered go to 'Settings -> Contact Information' and register a new |
| 30 | e-mail address there. Make sure you confirm your e-mail address by |
| 31 | clicking on the link in the e-mail verification mail sent by Gerrit. |
| 32 | If you don't receive the e-mail verification mail it might be that it |
| 33 | was caught by your spam filter. |
| 34 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 35 | === Incorrect author information |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 36 | |
| 37 | For every commit Git maintains the author. If not explicitly |
| 38 | specified Git computes the author on commit out of the Git |
| 39 | configuration 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 | |
| 49 | A commit done with the above Git configuration would have |
| 50 | "John Doe <john.doe@example.com>" as author. |
| 51 | |
| 52 | You can see the author information for existing commits in the |
| 53 | history. |
| 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 | |
| 65 | Check in Git that the author information of the commit that should |
| 66 | be pushed is correct. The author should have the same e-mail address |
| 67 | that you've configured for your Gerrit account. If the author |
| 68 | information is incorrect set the Git configuration parameters |
| 69 | 'user.name' and 'user.email' to the correct values (you might want to |
| 70 | set 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 | |
| 79 | Now you should update the author for those commits where the author |
| 80 | information is wrong. If only the last commit is affected you can do |
| 81 | this 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 | |
| 87 | If you need to update the author information for several commits it |
| 88 | gets more complicated. In this case you have to do an interactive |
| 89 | git rebase for the affected commits. While doing the interactive |
| 90 | rebase you have to choose 'edit' for those commits for which the |
| 91 | author should be rewritten. When the rebase stops at such a commit |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 92 | you have to amend the commit, explicitly setting the author |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 93 | before continuing the rebase. |
| 94 | |
Shawn O. Pearce | 392ef85 | 2011-10-11 10:50:36 -0700 | [diff] [blame] | 95 | Here is an example that shows how the interactive rebase is used to |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 96 | update 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 | |
| 124 | For further details about git rebase please check the |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 125 | link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[Git documentation,role=external,window=_blank]. |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 126 | |
| 127 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 128 | == Missing privileges to push commits of other users |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 129 | |
David Pursehouse | c6fd5a6 | 2012-06-26 13:42:11 +0900 | [diff] [blame] | 130 | If pushing to Gerrit fails with the error message "invalid author" |
| 131 | and somebody else is author of the commit for which the |
Edwin Kempin | 9b34e35 | 2010-12-23 07:36:31 +0100 | [diff] [blame] | 132 | push fails, then you have no permissions to forge the author |
| 133 | identity. In this case you may contact the project owner to request |
| 134 | the access right '+1 Forge Author Identity' in the 'Forge Identity' |
| 135 | category or ask the maintainer to commit this change on the author's |
| 136 | behalf. |
| 137 | |
| 138 | |
| 139 | GERRIT |
| 140 | ------ |
| 141 | Part of link:error-messages.html[Gerrit Error Messages] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 142 | |
| 143 | SEARCHBOX |
| 144 | --------- |