1

I am trying to push a change in Gerrit using the following command,

git push origin HEAD:refs/for/audi

but I am getting the following error:

fatal: One or more refs/for/ names blocks change upload
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I tried other solutions in SO and other sites but to no success like:

https://review.typo3.org/Documentation/error-change-upload-blocked.html

Command:

git for-each-ref refs/for

returns nothing.

Am stuck for an important software delivery to the client, please help.

Note: The response for git remote is as follows:

git remote -v

origin ssh://14.140.172.187:29418/android_m/hlos/platform/build (fetch)

origin ssh://14.140.172.187:29418/android_m/hlos/platform/build (push)

5
  • Why are you using that syntax for pushing? Why not just git push origin some_branch? Commented May 12, 2018 at 6:25
  • the ptach should go to gerrit server for review and from it should be pushed. Note: i tried but same error message Commented May 12, 2018 at 6:28
  • @TimBiegeleisen It's Gerrit's syntax for commits that need review before being merged into the target branch. Commented May 12, 2018 at 6:28
  • What does git fetch return? Commented May 12, 2018 at 6:56
  • its returning nothing. Commented May 14, 2018 at 12:10

1 Answer 1

1

While you may not have any local refs/for branches to delete (since you mention that the command git for-each-ref refs/for returns nothing), the Gerrit documentation for that error message does stipulate:

Branches under the 'refs/for/' namespace can be created by users that bypass Gerrit and push directly to the git repository itself (not using the Gerrit server’s SSH port).

So check first what origin is referring to (it should be the gerrit server), with git remote -v.
But check also the final repo which is proxied behing the Gerrit repo: this is where no /refs/for branch should be. It is in that remote repo you should delete any refs/for branches.

https://gerrit-documentation.storage.googleapis.com/Documentation/2.15.1/images/intro-quick-central-gerrit.png

"That" repo means the "authoritative" repo.

If you have the right to push directly to that remote repo (again, not the Gerrit one, but the one Gerrit is supposed to push to), you need to delete those remote branches.
Clone that repo, apply the command mentioned in the doc:

for n in $(git for-each-ref --format='%(refname)' refs/for);
    do git update-ref -d $n; done

Then push back with git push --mirror.

If you don't have the right to push to that remote client repo, contact the client and ask for the cleanup to be done in that target repo.

Sign up to request clarification or add additional context in comments.

9 Comments

thanks, for megit remote -v origin ssh://14.140.172.187:29418/android_m/hlos/platform/build (fetch) origin ssh://14.140.172.187:29418/android_m/hlos/platform/build (push)
it shows no intermediate branches. Is it something related to access rights to repository? how can i verify if the access rights are correct for th euser?
@Anshul I am talking about the authorative repo, so not one you are referencing in your local machine through git remote, but one on the server side: you need to check for refs/for branches there, on that server, in that repo.
any idea how to do it.. we are using a bare repo to sync our code. Its on same server and accessible.
@Anshul Then to the bare repo folder, and do a git branch -avv in it.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.