首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[ Git篇 ] git push / Please read the documentation and contact an administrator

[ Git篇 ] git push / Please read the documentation and contact an administrator

作者头像
程序手艺人
发布2019-02-21 17:17:01
1.9K0
发布2019-02-21 17:17:01
举报
文章被收录于专栏:程序手艺人程序手艺人

更新代码的时候出现:

具体操作步骤:

  1. git remote update
  2. git rebase origin name

出现如下:

Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 8.02 KiB | 0 bytes/s, done.
Total 8 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6)
remote: Branch refs/heads/sense:
remote: You are not allowed to perform this operation.
remote: To push into this reference you need 'Push' rights.
remote: User: xxx
remote: Please read the documentation and contact an administrator
remote: if you feel the configuration is incorrect
remote: Processing changes: refs: 1, done    
To ssh://xxx/xxx
 ! [remote rejected] xxx -> xxx (prohibited by Gerrit)
error: failed to push some refs to 'ssh://xxx/xxx'
解决方案

遇到该问题的时候,百思不得其解,命名昨天还是好的,今天怎么会这样,反复思考之后,返现我昨天遇到编译错误,删除了仓库,重新从服务器拉取了最新分支,找到问题的突破口,解决步骤:

  1. 首先查看代码目录下的 .git / config 配置文件
[core]
	repositoryformatversion = 0
	filemode = true
[remote "demo"]
	url = ssh:xxx
	review = review.source.android.com
	projectname = buildroot
	fetch = +refs/heads/*:refs/remotes/xxx/*
[branch "sense"]
	remote = xxx
	merge = xxx

可以发现[remote “demo”]只有获取代码的权限,没有push代码的权限,导致push 报错 , 服务器的代码主要是由Geriit+Git+Repo 构成版本及审核机制,重新回忆下拉取代码的流程,发现过程中少了一步建立Gerrit 审核代码的机制 ,执行之后,可以正常提交

repo forall -c 'git config remote.xxx.push refs/heads/*:refs/for/*'

正常的 .git/config 文件配置

[core]
	repositoryformatversion = 0
	filemode = true
[remote "demo"]
	url = ssh:xxx
	review = review.source.android.com
	projectname = buildroot
	fetch = +refs/heads/*:refs/remotes/xxx/*
	push = refs/heads/*:refs/for/*
[branch "sense"]
	remote = xxx
	merge = xxx
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年11月28日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档