Problems with initializing a new project and commit a new change

1,820 views
Skip to first unread message

Baz

unread,
Jun 30, 2011, 3:40:16 PM6/30/11
to repo-d...@googlegroups.com
Hi,

I am still working on the process of initializing a new project from an existing git repo, then commit a new change. I am following the following example, http://unethicalblogger.com/2009/12/07/code-review-with-gerrit-a-mostly-visual-guide.html. This seems to be the only one end-to-end example that I can find. Please let me know if there is another one available.

Here is my issue:

1. I have created a new project via ssh.
2. In my local machine, I performed "git clone git:/repos/test_abc.git test_abc.git.
3. cd test_abc.git.
4. git checkout master.
5. git remote add gerrithost ssh://baztheman@gerrit_host:29418/test_abc.git.
6. git push gerrithost master.

This is where I am having trouble. Here is the error message:

xxx-MacBook-Pro-2:testrepo.git baztheman$ git push gerrithost master
Counting objects: 87, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (87/87), 7.92 KiB, done.
Total 87 (delta 11), reused 87 (delta 11)
remote: Resolving deltas: 100% (11/11)
remote:
remote: ERROR:  In commit f2a0d47d89ffefec0e685e593c0b8d9b338bbea8
remote: ERROR:  committer email address another_user_id@company_name.com
remote: ERROR:  does not match your user account.
remote: ERROR:
remote: ERROR:  The following addresses are currently registered:
remote: ERROR:    bazt...@gmail.com
remote: ERROR:
remote: ERROR:  To register an email address, please visit:
remote: ERROR:  http://gerrit_host.company_name.com:8080/#settings,contact
remote:
remote:
To ssh://baztheman@gerrit_host:29418/test_abc.git
 ! [remote rejected] master -> master (invalid committer)
error: failed to push some refs to 'ssh://baztheman@gerrit_host:29418/test_abc.git'

I am not sure what have changed to cause the above error. I have been researching on access and permission according to some of the post online. The error was:

xxx-MacBook-Pro-2:testrepo.git baztheman$ git push gerrithost master
Counting objects: 87, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (87/87), 7.92 KiB, done.
Total 87 (delta 11), reused 87 (delta 11)
remote: Resolving deltas: 100% (11/11)
To ssh://baztheman@gerrit_host:29418/test_abc.git
 ! [remote rejected] master -> master (prohibited by Gerrit)
error: failed to push some refs to 'ssh://baztheman@gerrit_host:29418/test_abc.git'

Can anyone help me for this basic issue?

Thank you.

B.


Andreas Häber

unread,
Jun 30, 2011, 3:54:01 PM6/30/11
to Baz, repo-d...@googlegroups.com
Hi,

xxx-MacBook-Pro-2:testrepo.git baztheman$ git push gerrithost master
Counting objects: 87, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (87/87), 7.92 KiB, done.
Total 87 (delta 11), reused 87 (delta 11)
remote: Resolving deltas: 100% (11/11)
remote:
remote: ERROR:  In commit f2a0d47d89ffefec0e685e593c0b8d9b338bbea8
remote: ERROR:  committer email address another_user_id@company_name.com
remote: ERROR:  does not match your user account.
remote: ERROR:
remote: ERROR:  The following addresses are currently registered:
remote: ERROR:    bazt...@gmail.com
remote: ERROR:
remote: ERROR:  To register an email address, please visit:
remote: ERROR:  http://gerrit_host.company_name.com:8080/#settings,contact
remote:
remote:
To ssh://baztheman@gerrit_host:29418/test_abc.git
 ! [remote rejected] master -> master (invalid committer)
error: failed to push some refs to 'ssh://baztheman@gerrit_host:29418/test_abc.git'


Seems like your git and gerrit identities are out of sync. See Shawn Pearce's reply at http://groups.google.com/group/repo-discuss/browse_thread/thread/1013d4700a50a8b3 for how to fix this. However, if you are importing someone else's code you can try to use forged identities instead. See http://gerrit.googlecode.com/svn/documentation/2.1.7/access-control.html#category_FORG (replace 2.1.7 with whatever version you're using at your server).
 
I am not sure what have changed to cause the above error. I have been researching on access and permission according to some of the post online. The error was:

xxx-MacBook-Pro-2:testrepo.git baztheman$ git push gerrithost master
Counting objects: 87, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (87/87), 7.92 KiB, done.
Total 87 (delta 11), reused 87 (delta 11)
remote: Resolving deltas: 100% (11/11)
To ssh://baztheman@gerrit_host:29418/test_abc.git
 ! [remote rejected] master -> master (prohibited by Gerrit)
error: failed to push some refs to 'ssh://baztheman@gerrit_host:29418/test_abc.git'

The problem here is that you are pushing to the wrong branch. In Gerrit you need to push to /refs/for/branch (e.g., /refs/for/master) instead of to /refs/heads/branch. It can be a time saver to change your local .git/config to by default push to /refs/for/branch. So try the following command instead:
$ git push gerrithost HEAD:refs/for/master

Good luck!

BR, andreas

 
Can anyone help me for this basic issue?

Thank you.

B.

Baz

unread,
Jun 30, 2011, 4:08:51 PM6/30/11
to Andreas Häber, repo-d...@googlegroups.com
Thanks for the quick reply.

I tried "git push gerrithost HEAD:refs/for/master" and still have the same error:

MAC_BOOK_USERID-MacBook-Pro-2:testrepo.git MAC_BOOK_USERID$ git push gerrithost HEAD:refs/for/master

Counting objects: 87, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (87/87), 7.92 KiB, done.
Total 87 (delta 11), reused 87 (delta 11)
remote: Resolving deltas: 100% (11/11)
remote:
remote: ERROR:  In commit fc9bcfcc30bf32a58cde463509b7b67bdf58e83e
remote: ERROR:  committer email address my_boss@not_my_company_name.com

remote: ERROR:  does not match your user account.
remote: ERROR:
remote: ERROR:  The following addresses are currently registered:
remote: ERROR:    my_ger...@gmail.com

remote: ERROR:
remote: ERROR:  To register an email address, please visit:
remote: ERROR:  http://gerrit_host:8080/#settings,contact
remote:
remote:
To ssh://my_gerrit_id@gerrit_host:29418/test_abc.git
 ! [remote rejected] HEAD -> refs/for/master (invalid committer)
error: failed to push some refs to 'ssh://my_gerrit_id@gerrit_host:29418/test_abc.git'

I have tested the ssh/gerrit connection and passed by the following commands: "ssh -p 29418 my_gerrit_id@gerrit_host". So I know the ssh/gerrit connection with my gerrit userid and .gitconfig file should be setup correctly.

Please advice.

Thanks.

B.

Andreas Häber

unread,
Jun 30, 2011, 4:42:35 PM6/30/11
to Baz, repo-d...@googlegroups.com
The error you are receiving now is the first one I replied to in your previous mail. Normally users cannot forge identities (i.e., push commits that were commited by someone else). There are special policies to allow this called Forge identity and Forge commiter that you can give to a group you are member of. See http://gerrit.googlecode.com/svn/documentation/2.1.7/error-you-are-not-committer.html for further information on this.

Another alternative is to bypass review for these commits by pushing directly to refs/heads/master (or other branch). That is very convenient when importing old repositories to avoid having to review the whole history. See http://gerrit.googlecode.com/svn/documentation/2.1.7/access-control.html#category_pHD for further details.

See also http://gerrit.googlecode.com/svn/documentation/2.1.7/error-messages.html for info on various Gerrit error messages and help on what to do.

BR, andreas

Baz

unread,
Jun 30, 2011, 8:29:29 PM6/30/11
to Andreas Häber, repo-d...@googlegroups.com
Thanks. I added "forge identity" to access for Administrator group. The end to end flow is now working. I am going to run more tests to perfect the process. Thank you.

R. Tyler Croy

unread,
Jul 1, 2011, 12:59:42 PM7/1/11
to Baz, Andreas H?ber, repo-d...@googlegroups.com

On Thu, 30 Jun 2011, Baz wrote:

> Thanks. I added "forge identity" to access for Administrator group. The end
> to end flow is now working. I am going to run more tests to perfect the
> process. Thank you.

As the author of the original post you referenced, I think given some of the
most recent changes to the Gerrit UI it might be time for me to update my guide
:)


- R. Tyler Croy
--------------------------------------
Code: http://github.com/rtyler
Chatter: http://identi.ca/agentdero
http://twitter.com/agentdero

Reply all
Reply to author
Forward
0 new messages