You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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 audi branch in the android_m/hlos/platform/build repo. 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:
    ssh -p 29418 14.140.172.187
    
    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.

Check for Branch-Specific Restrictions

The refs/for/ block error often ties to branch configuration:

  • Verify the audi branch 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 master temporarily to rule out branch-specific issues:
    git push origin HEAD:refs/for/master
    
    If this works, the problem is isolated to the audi branch’s settings—your admin might have enabled restrictions that block direct refs/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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:27:41