Pushing pre-existing repos in to Gerrit

1,185 views
Skip to first unread message

Luciano Carvalho

unread,
Jul 23, 2009, 7:28:37 PM7/23/09
to repo-d...@googlegroups.com
Hi Shawn,

I have a lot of Git repos and I want now to have all the developers submitting code to it through Gerrit.
We could create a sandbox and dry run some tests here. The tool is working really well in the developer perspective, I can create a change, submit it, approve and merge.

Now, what I'm trying to do is to get the old repos I already have and push them to Gerrit.
All the projects are already created, master branch was also created in the tool's db and physically.
The problem is: when I try to push the repos to Gerrit the remote rejects my push saying I'm not the committer. And I sure won't be a committer for most of the repos we have cause they all have their own CM/development team and I'll never touch their code.

How do I create the baseline for the developers to start pushing their changes? Is there any special procedure to do that?
How would I get all this huge amount of data I already have and put it under Gerrit?

Thanks,

Luciano.

Simon Wilkinson

unread,
Jul 23, 2009, 7:40:43 PM7/23/09
to repo-d...@googlegroups.com

On 24 Jul 2009, at 00:28, Luciano Carvalho wrote:

> How do I create the baseline for the developers to start pushing
> their changes? Is there any special procedure to do that?
> How would I get all this huge amount of data I already have and put
> it under Gerrit?

I did this for OpenAFS by just creating a mirror of the existing bare
repository in a suitable place on the filesystem, and then creating
the initial project and branch entries in the database as described in
the documentation.

One sticking point is that you have to manually create all of the
branches you wish to still allow pushes to through the database
interface - the Gerrit web interface only supports creating new
branches - you can't use it to add existing ones to Gerrit.

Hope that helps!

Simon.

Shawn Pearce

unread,
Jul 24, 2009, 10:05:15 AM7/24/09
to repo-d...@googlegroups.com
Sorry for the late reply, I was away from email yesterday.

Go into the '-- All Projects ---' entry under Admin>Projects and grant the following:

  Category: Push Branch
  Group: Administrators 
  Min: +1
  Max: +3

  Category: Push Annotated Tag
  Group: Administrators
  Min: +1
  Max: +3

After doing those two grants, you can then push the branches directly using git push, e.g.:

  git push --all ssh://you@gerrit:29418/project.git


Once all projects are pushed, you can delete the two grants you had given Administrators.  The advantage of pushing through Gerrit's SSHD like this is the branches table will be automatically populated in the database, so unlike what Simon Wilkinson describes, you won't need to manually insert each branch for each project.

Luciano Carvalho

unread,
Jul 24, 2009, 12:12:27 PM7/24/09
to repo-d...@googlegroups.com
Hi Shawn,

After the setup you propose, we still get the same problem:

$ git push ssh://user@gerrit:29418/project1 HEAD:refs/for/master 
Warning: No xauth data; using fake authentication data for X11 forwarding.
Counting objects: 3293, done.
Compressing objects: 100% (1123/1123), done.
Writing objects: 100% (3293/3293), 3.53 MiB | 82 KiB/s, done.
Total 3293 (delta 2110), reused 3292 (delta 2110)
To ssh://user@gerrit:29418/project1
 ! [remote rejected] HEAD -> refs/for/master (you are not committer som...@server.com)


Any other tips?

Thanks,

Luciano

Shawn Pearce

unread,
Jul 24, 2009, 12:37:39 PM7/24/09
to repo-d...@googlegroups.com
On Fri, Jul 24, 2009 at 09:12, Luciano Carvalho <lsca...@gmail.com> wrote:
After the setup you propose, we still get the same problem:

$ git push ssh://user@gerrit:29418/project1 HEAD:refs/for/master 

No, use:

  git push ssh://user@gerrit:29418/project1 HEAD:refs/heads/master  

since you want to directly push into the branch, rather than create code reviews.  Pushing to prefix "refs/for/" creates code reviews which must be approved and then submitted.  Pushing to "refs/heads/" bypasses review entirely, and just enters the commits directly into the branch.  The latter path does not check committer identity, and is designed for the case you are trying to work through right now.  :-)

Simon Wilkinson

unread,
Jul 24, 2009, 12:58:14 PM7/24/09
to repo-d...@googlegroups.com

On 24 Jul 2009, at 17:12, Luciano Carvalho wrote:
>
> After the setup you propose, we still get the same problem:
>
> $ git push ssh://user@gerrit:29418/project1 HEAD:refs/for/master

To push directly, I think you need to push to refs/heads/master

S.

Luciano Carvalho

unread,
Jul 24, 2009, 6:21:13 PM7/24/09
to repo-d...@googlegroups.com
Shawn, Simon,

It looks like it is going through, but it the end, it returns a lock error:

git push ssh://user@gerrit:29418/project1 HEAD:refs/heads/master
Counting objects: 3294, done.
Compressing objects: 100% (1127/1127), done.
Writing objects: 100% (3293/3293), 3.53 MiB | 83 KiB/s, done.
Total 3293 (delta 2107), reused 3292 (delta 2107)
To ssh://user@gerrit:29418/project1
 ! [remote rejected] HEAD -> master (lock error: /home/gerrit/repositories/project1.git/logs/refs/heads/master (Permission denied))
error: failed to push some refs to 'ssh://user@gerrit:29418/project1'


Gerrit's repos are supposed to be empty. Any idea where this could come from?

Thanks,

Luciano.

Jean-Baptiste Queru

unread,
Jul 24, 2009, 6:26:48 PM7/24/09
to repo-d...@googlegroups.com
You need to give yourself permissions to update branch / create branch
in Gerrit for this project (i.e. push branch +2)

JBQ
--
Jean-Baptiste M. "JBQ" Queru
Software Engineer, Android Open-Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

Shawn Pearce

unread,
Jul 24, 2009, 6:27:13 PM7/24/09
to repo-d...@googlegroups.com
On Fri, Jul 24, 2009 at 15:21, Luciano Carvalho <lsca...@gmail.com> wrote:

It looks like it is going through, but it the end, it returns a lock error:

git push ssh://user@gerrit:29418/project1 HEAD:refs/heads/master
... 
 ! [remote rejected] HEAD -> master (lock error: /home/gerrit/repositories/project1.git/logs/refs/heads/master (Permission denied))

Gerrit's repos are supposed to be empty. Any idea where this could come from?

The Gerrit user can't append to the logs/refs/heads/master file in the project.  (Or, it can't create the directories and/or files in that path.)  Double check that the user account the Gerrit daemon is running as actually owns that repository and its contents. 

Shawn Pearce

unread,
Feb 15, 2010, 10:57:42 AM2/15/10
to Mike.lifeguard, repo-discuss
"Mike.lifeguard" <mike.li...@gmail.com> wrote:
> Is there no way to submit commits for code review when you're "not"
> the committer? I have a repo (and will have more in the future) which
> came from SVN. So, those are recorded as being committed by
> SVNusername@SVNrepoUUID and not by me (well, I don't have multiple
> personality disorder, I think that I committed those too!)
>
> I could bypass this by pushing to refs/heads/master, but I do want
> code reviews created so I can move comments from an old review system
> to new. Can the check be disabled temporarily or something? Whether
> you want to create code reviews is actually independent of whether you
> want committer checked on push; they should be treated separately.

That's why in the next release, 2.1.2, we have the new access
control Forge Identity +2, which allows you to upload commits
that aren't you.

Unfortunately we havent released 2.1.2 yet because the performance of
the syntax highlighting is horrible when you have a lot of traffic.
We're running it internally, so its stable enough for a production
review system, but performance isn't where it should be, so I have
been refusing to mark a release.

So to get the Forge Identity +2 access control you'll have to
download the latest source directly from Git and build the WAR
yourself. Or, you could take the 2.1.1.1 sources from Git and
comment out the validateCommitter check within Receive.java, then
build a custom WAR for your use.

Reply all
Reply to author
Forward
0 new messages