当前位置:   article > 正文

git报错prohibited by Gerrit: not permitted: update

prohibited by gerrit: not permitted: update

在这里插入图片描述

git push报错:

Push to refs/for/[branch] to create a review, or get 'Push' rights to update the branch.
Contact an administrator to fix the permissions
(prohibited by Gerrit: not permitted: update)
  • 1
  • 2
  • 3

原因:
使用Gerrit代码审核时,本地push代码是push到refs/for/[branch],而不是refs/heads/[branch]

解决:
设置 Git 远程仓库的推送规则,添加本地新分支的push权限

git config remote.origin.push refs/heads/[branch]:refs/for/[branch]
  • 1

[branch]是分支名
remote.origin.push: 这指定了要对哪个远程仓库进行推送操作,在这里是 origin 远程仓库
refs/heads/[branch]:refs/for/[branch]: 这是一个推送规则,它将本地的 refs/heads/[branch] 分支映射到远程的 refs/for/[branch] 分支上
当你执行 git push 命令时,Git 会自动将你本地的所有分支推送到远程的 refs/for/[branch] 分支上,而不是直接推送到 refs/heads/[branch] 分支

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/792109
推荐阅读
  

闽ICP备14008679号