git push --mirror with gerrit

2,215 views
Skip to first unread message

ffa

unread,
May 28, 2012, 1:59:43 AM5/28/12
to repo-d...@googlegroups.com
git push --mirror does not work for me. I get two errors. One error is for branches "can not create new references". The other is for tags which initially pushes successfully, but then failed with "failed to lock". If I grant all privileges to refs/*, it pushes, but when I clone, nothing shows. The GUI shows nothing under the branches section of the project. And, It doesn't seem to push the branches under refs/heads/. Is everyone using repo to do stuff like this? Because, all of my searches seem to return discussions about using repo to mirror or initialize the mirror.

Magnus Bäck

unread,
May 28, 2012, 11:52:46 AM5/28/12
to Repo and Gerrit Discussion
On Mon, May 28, 2012 at 1:59 AM,
ffa <ako...@mindboxstudios.com> wrote:

> git push --mirror does not work for me. I get two errors. One error is for
> branches "can not create new references".

Seeing the terminal output would help.

> The other is for tags which initially pushes successfully, but then
> failed with "failed to lock".

I've seen this message too, and I think it's caused by a) the tag
already exists or b) there are no branches pointing to the tag (making
the tag invisible to clients).

> If I grant all privileges to refs/*, it pushes, but when I clone, nothing
> shows. The GUI shows nothing under the branches section of the
> project. And, It doesn't seem to push the branches under refs/heads/.

Instead of using --mirror, push a single branch and see what happens.

git push ssh://user@host:29418/path/to/git mybranch:refs/heads/mybranch

(Or origin/mybranch:refs/heads/mybranch or whatever it is that you're pushing.)

Is the push reported as successful? Does it show up on the Branches
page? Is there a change in the refs in the underlying git on the
server (assuming you have server access)?

> Is everyone using repo to do stuff like this? Because, all of my
> searches seem to return discussions about using repo to mirror
> or initialize the mirror.

If you're dealing with multiple gits managed by Repo, it's natural to
use Repo (specifically the "forall" subcommand) to automate operations
for all gits. Apart from that, Repo has nothing to do with the pushes.
It's just a wrapper tool to ease the pain of dealing with hundreds of
gits.

--
Magnus Bäck
ba...@google.com

ffa

unread,
May 28, 2012, 4:31:20 PM5/28/12
to repo-d...@googlegroups.com

> git push --mirror does not work for me. I get two errors. One error is for
> branches "can not create new references".

Seeing the terminal output would help.

Here is output from trying to mirror the gerrit repo.

Counting objects: 65298, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13502/13502), done.
Writing objects: 100% (65298/65298), 12.66 MiB | 659 KiB/s, done.
Total 65298 (delta 36337), reused 65213 (delta 36337)
remote: Resolving deltas: 100% (36337/36337)
remote: Processing changes: refs: 180, done
To ssh://<remote>/gerrit.git
 * [new tag]         v1.0 -> v1.0
 * [new tag]         v1.0.end -> v1.0.end
...
 ! [remote rejected] upstream/exp-gimd -> upstream/exp-gimd (can not create new references)
 ! [remote rejected] upstream/exp-label -> upstream/exp-label (can not create new references)
 ! [remote rejected] upstream/exp-nosql -> upstream/exp-nosql (can not create new references)
 ! [remote rejected] upstream/master -> upstream/master (can not create new references)
 ! [remote rejected] upstream/stable -> upstream/stable (can not create new references)
 ! [remote rejected] upstream/stable-2.3 -> upstream/stable-2.3 (can not create new references)
 ! [remote rejected] upstream/stable-2.4 -> upstream/stable-2.4 (can not create new references)
error: failed to push some refs to 'ssh://<remote>/gerrit.git'


> If I grant all privileges to refs/*, it pushes, but when I clone, nothing
> shows. The GUI shows nothing under the branches section of the
> project. And, It doesn't seem to push the branches under refs/heads/.

Instead of using --mirror, push a single branch and see what happens.

git push ssh://user@host:29418/path/to/git mybranch:refs/heads/mybranch

(Or origin/mybranch:refs/heads/mybranch or whatever it is that you're pushing.)

Is the push reported as successful? Does it show up on the Branches
page? Is there a change in the refs in the underlying git on the
server (assuming you have server access)?


This following tests are with permissions for refs/heads/*.

The below command fails.

$ git push origin upstream/stable-2.4
Counting objects: 58546, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12533/12533), done.
Writing objects: 100% (58546/58546), 11.65 MiB | 644 KiB/s, done.
Total 58546 (delta 33007), reused 57785 (delta 32473)
remote: Resolving deltas: 100% (33007/33007)
remote: Processing changes: refs: 1, done
To ssh://<remote>/gerrit.git
 ! [remote rejected] upstream/stable-2.4 -> upstream/stable-2.4 (can not create new references)
error: failed to push some refs to 'ssh://<remote>/gerrit.git'


The below command was successful, and the branch shows up in the branches pages and under refs in the bare repo.

$ git push origin upstream/stable-2.4:refs/heads/upstream/stable-2.4
Counting objects: 58546, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12533/12533), done.
Writing objects: 100% (58546/58546), 11.65 MiB | 644 KiB/s, done.
Total 58546 (delta 33008), reused 57785 (delta 32473)
remote: Resolving deltas: 100% (33008/33008)
remote: Processing changes: refs: 1, done
To ssh://<remote>/gerrit.git
 * [new branch]      upstream/stable-2.4 -> upstream/stable-2.4



ffa

unread,
May 28, 2012, 4:35:20 PM5/28/12
to repo-d...@googlegroups.com
Also, I have only fetched the branches I am mirroring or pushing.

for example:
git fetch upstream
git push --mirror origin
Reply all
Reply to author
Forward
0 new messages