Reputation: 1436
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)
Upvotes: 1
Views: 694
Reputation: 1323383
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.
"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.
Upvotes: 1