Repository Migration to Gerrit, git push --mirror returns refs/meta/config (cannot delete project configuration)

1,822 views
Skip to first unread message

Kung

unread,
Oct 3, 2014, 4:27:44 AM10/3/14
to repo-d...@googlegroups.com

I got some strange problems when migrating my old git repository which resides in a redmine, to my new Gerrit repository.

Basically i made a

git clone --mirror ssh:// .... old-repo.git
cd old-repo.git/
git push --mirror ssh:// .... new-gerrit-repo

Well, now I first got some warnings:

remote: (W) a01300f: commit message lines >70 characters; manually wrap lines
remote: (W) 8def171: commit subject >65 characters; use shorter first paragraph

which I guess I can ignore, because the original repository will still exist as reference.

My main problem is this error:

! [remote rejected] refs/meta/config (cannot delete project configuration)
error: failed to push some refs to ssh:// .... new-gerrit-repo

After some reading I found out, that this refs/meta/config branch only contains some project specific rules for Gerrit. It's a has a few config files for parametrizing Gerrit. (it's basically the Project Options page under Gerrit "General" Tab) There are no project-related source files.

Can someone help me? Is it save to ignore this error and go on with the migration?

Access push;read;submit rights are given for Administrators on refs/meta/config. Nothing helped.

Jan Kundrát

unread,
Oct 3, 2014, 5:35:26 AM10/3/14
to repo-d...@googlegroups.com
On Friday, 3 October 2014 10:27:44 CEST, Kung wrote:
> ! [remote rejected] refs/meta/config (cannot delete project configuration)
> error: failed to push some refs to ssh:// .... new-gerrit-repo

The original repository doesn't have refs/meta/config, and therefore the
--mirror option for `git push` attempts to delete it from Gerrit as well.
The easiest way is probably to fetch refs/meta/config from Gerrit and push
it into your Redmine.

Hope this helps,
Jan

--
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/

Alex Blewitt

unread,
Oct 3, 2014, 6:18:50 AM10/3/14
to Kung, repo-d...@googlegroups.com
When you do push --mirror it will try and set up all the refs the same as the ones that are visible. The repository you are reading from has a refs/meta/config but it appears you cannot see it. 

git ls-remote (source repo) 

Should say if you can see it or not. 

If you cannot see it then the mirror operation will attempt to delete it on the destination server which is what git is preventing. 

You should grant read on refs/* and refs/meta/config in order to mirror all refs.

Alex

Sent from my iPhat 6
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kung

unread,
Oct 3, 2014, 6:19:06 AM10/3/14
to repo-d...@googlegroups.com
Hi,

I tried this:

First i cloned the new Gerrit Git Repo; then 

$ git fetch origin refs/meta/config:refs/remotes/origin/meta/config
 * [new ref]         refs/meta/config -> origin/meta/config

$ git checkout meta/config
Branch meta/config set up to track remote branch meta/config from origin.
Switched to a new branch 'meta/config'

$ git push ssh://...new-gerrit-repo meta/config

remote: *** hooks.mailinglist is not set so no email will be sent
remote: *** for refs/heads/meta/config update 0000000000000000000000000000000000
000000->f908248d5badf509d69ea1cfc11df6ab729a6ce5
To ssh://... new gerrit repo
 * [new branch]      meta/config -> meta/config

Then i switched back to my mirrored clone folder of the old repo and did again:

$ git push --mirror ssh://...new-gerrit-repo

remote: Processing changes: refs: 1, done
To ssh://...new-gerrit-repo
 ! [remote rejected] refs/meta/config (cannot delete project configuration)
error: failed to push some refs to 'ssh://...new-gerrit-repo'


Any suggestions ?

thanks for your help!

Kung

unread,
Oct 3, 2014, 6:32:08 AM10/3/14
to repo-d...@googlegroups.com
However,

I think if I ignore it, it wouldn't matter, because these refs/* branches are only for gerrit and shouldn't harm my other repository, no matter if it is a mirrored clone. Am I correct?

Kung

unread,
Oct 3, 2014, 6:39:25 AM10/3/14
to repo-d...@googlegroups.com, kung...@gmail.com
I tried to grant read on refs/* and refs/meta/config; but it didn't help.

On my redmine git, there is no such branch as refs/meta/config, so the mirror tries to delete that one on my new gerrit repo, but it doesn't work.

Jan Kundrát

unread,
Oct 3, 2014, 7:52:53 AM10/3/14
to repo-d...@googlegroups.com
On Friday, 3 October 2014 12:19:06 CEST, Kung wrote:
> $ git push ssh://...new-gerrit-repo meta/config
>
> remote: *** hooks.mailinglist is not set so no email will be sent
> remote: *** for refs/heads/meta/config update

That's because you're pushing to refs/heads/meta/config. You have to push
to refs/meta/config. It's is not in that customary refs/heads/ namespace.

Cheers,

Kung

unread,
Oct 3, 2014, 9:25:30 AM10/3/14
to repo-d...@googlegroups.com
Hi,

thanks, i saw it.

Now I deleted it and created the correct one:

git ls-remote

8d84eb8bf64e827894325c110b0326ee0342472b        HEAD
cf41d73ce7832220ae3886c02e2d18eecef924f8        refs/heads/....
.....
.....
28a36cc348c33d4c230ecb0e698f4510f70df7d5        refs/meta/config

then i made a git remote update on the mirrored clone and tried again

Kung

unread,
Oct 3, 2014, 9:29:19 AM10/3/14
to repo-d...@googlegroups.com
then i made a git remote update on the mirrored clone and tried again but nothing changed; it still doesn't work.
 

Am Freitag, 3. Oktober 2014 15:25:30 UTC+2 schrieb Kung:
Hi,

thanks, i saw it.

Now I deleted it and created the correct one:

git ls-remote

8d84eb8bf64e827894325c110b0326ee0342472b        HEAD
cf41d73ce7832220ae3886c02e2d18eecef924f8        refs/heads/....
.....
.....
28a36cc348c33d4c230ecb0e698f4510f70df7d5        refs/meta/config

then i made a git remote update on the mirrored clone and tried again but nothing changed; it still doesn't work.

Jan Kundrát

unread,
Oct 3, 2014, 11:36:20 AM10/3/14
to repo-d...@googlegroups.com
On Friday, 3 October 2014 15:29:19 CEST, Kung wrote:
> nothing changed; it still doesn't work

What doesn't work? What is the expected behavior, what is the actual
behavior, what commands are you executing, and most important, what is the
error message?

Kung

unread,
Oct 5, 2014, 7:09:17 AM10/5/14
to repo-d...@googlegroups.com
Hey,

I still get the error when pushing with --mirror on my new repository:

! [remote rejected] refs/meta/config (cannot delete project configuration)
error: failed to push some refs to ssh:// .... new-gerrit-repo
Basically I went into the new repository, made a 

git fetch origin refs/meta/config 
and then
git checkout FETCH_HEAD

Now I verified, that I got the config branch; and made a 

git push ssh://...old-repository.git refs/meta/config

Now I got the config branch in my old repo; I returned in the mirrored clone folder;

git remote update

Got the new Branch, and here I made a

git push --mirror ssh:// ... new-repository

to update the repository but I got the error again:

! [remote rejected] refs/meta/config (cannot delete project configuration)
error: failed to push some refs to ssh:// .... new-gerrit-repo

I just wanted to try to fix it with your suggestion:
The easiest way is probably to fetch refs/meta/config from Gerrit and push 
it into your Redmine. 

Thanks for your help !!!

Kung

unread,
Oct 5, 2014, 7:14:05 AM10/5/14
to repo-d...@googlegroups.com
>Now I verified, that I got the config branch; and made a 

I need to correct; the correct push for the config branch into my old repository was:

* git push ssh://...old-repository.git HEAD:refs/meta/config

Jan Kundrát

unread,
Oct 5, 2014, 6:01:25 PM10/5/14
to repo-d...@googlegroups.com
On Sunday, 5 October 2014 13:09:17 CEST, Kung wrote:
> ! [remote rejected] refs/meta/config (cannot delete project configuration)
> error: failed to push some refs to ssh:// .... new-gerrit-repo

Seems that your local clone from which you're pushing doesn't have
refs/meta/config. Below is why.

> Basically I went into the new repository, made a
>
> git fetch origin refs/meta/config
> and then
> git checkout FETCH_HEAD
>
> Now I verified, that I got the config branch; and made a
>
> git push ssh://...old-repository.git refs/meta/config
>
> Now I got the config branch in my old repo; I returned in the mirrored
> clone folder;
>
> git remote update

This is basically calling just a `git fetch`. However, the problem is that
refs/meta/config is not among the refs which git fetches by default, and so
even though you have indeed already created your refs/meta/config in the
old repo, your clone is not aware of it (and even if you re-clone, it won't
be aware).

You can fix this by adding something like this into your .git/config into
[remote "origin"]:

fetch = refs/meta/config:refs/meta/config

E.g. observe the difference between `git ls-remote` and `git branch -r`.

Cheers,
Jan

Roy Zeng

unread,
Oct 9, 2014, 2:29:58 AM10/9/14
to repo-d...@googlegroups.com
For below  warnings:
remote: (W) a01300f: commit message lines >70 characters; manually wrap lines
remote: (W) 8def171: commit subject >65 characters; use shorter first paragraph
You can ignore the warning message ( because you installed commit-message-length-validator plugin)
For errors:
! [remote rejected] refs/meta/config (cannot delete project configuration)
error: failed to push some refs to ssh:// .... new-gerrit-repo
It's expected result, you don't really want to push refs/meta/config, you should configure/change it in new gerrit server.

Reply all
Reply to author
Forward
0 new messages