Git Push至Gerrit报错求助:refs/for/阻止变更上传及仓库访问问题
Troubleshooting Gerrit Push Error:
refs/for/ Blocked & Repository Access Issues Hey there, let’s tackle this Gerrit push issue step by step—since you’ve got a critical delivery on the line, let’s get this sorted fast.
First, Lock Down Permissions & SSH Setup
The error calls out access rights first, so let’s start here:
- Double-check your SSH key in Gerrit: Log into the Gerrit web UI using
14.140.172.187, head to your user settings, and confirm your public SSH key is listed. Missing or outdated keys are a super common culprit here. - Confirm branch push permissions: Reach out to your Gerrit admin to make sure your account has explicit push access to the
audibranch in theandroid_m/hlos/platform/buildrepo. Some teams restrict certain branches to specific users, which could block your upload. - Test the SSH connection directly: Run this command to verify you can reach the Gerrit server:
You should see a Gerrit welcome message if the connection works. If not, check your local firewall settings or ask the server admin if port 29418 is open for your IP.ssh -p 29418 14.140.172.187
Check for Branch-Specific Restrictions
The refs/for/ block error often ties to branch configuration:
- Verify the
audibranch exists in Gerrit: Log into the web UI and check the branch list. If it doesn’t exist, you’ll need to create it first (or ask your admin to do so). - Test pushing to a known-good branch: Try pushing your changes to
mastertemporarily to rule out branch-specific issues:
If this works, the problem is isolated to thegit push origin HEAD:refs/for/masteraudibranch’s settings—your admin might have enabled restrictions that block directrefs/for/pushes.
Refresh Local Git & Gerrit Refs
Stale local references can cause weird blocking issues:
- Prune stale refs and fetch the latest from Gerrit:
git fetch origin --prune git remote prune origin - Try re-adding the remote just in case there’s a hidden typo or corruption:
git remote remove origin git remote add origin ssh://14.140.172.187:29418/android_m/hlos/platform/build
Emergency Workaround for Urgent Delivery
If you need to get changes up immediately:
- Create a temporary local branch and push that:
git checkout -b temp-audi-delivery git push origin temp-audi-delivery:refs/for/audi - Use Gerrit’s web UI upload: Zip up your commit changes, log into Gerrit, and use the "New Change" option to upload the zip directly. This skips the CLI push entirely and can get your changes in for review fast.
内容的提问来源于stack exchange,提问作者Anshul
相关产品推荐
相关产品推荐

