您的位置:首页 > 文旅 > 美景 > git报错prohibited by Gerrit: not permitted: update

git报错prohibited by Gerrit: not permitted: update

2024/10/6 16:18:19 来源:https://blog.csdn.net/qq_43680027/article/details/139328046  浏览:    关键词:git报错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)

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

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

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

[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] 分支

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com