0
点赞
收藏
分享

微信扫一扫

网络协议学习笔记

西曲风 2024-06-01 阅读 10
git

在这里插入图片描述

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

举报

相关推荐

0 条评论