解决GitLab Push master to origin/master was rejected by remote问题

问题描述

公司自己搭建的GitLab服务器,由管理人员创建了一个Android的Group,并在该Group下创建了一个项目叫MyProject,A是该分组的成员可以和该远程仓库建立连接,但是在push代码的时候却报了如下错误

字面意思就是被远程的服务拒绝了

Push master to origin/master was rejected by remote

问题解决

我猜测是因为权限不够被拒绝了,我就以管理员的账号登录查看该项目下A的角色权限,发现是Developer角色

接下来就是查看GitLab的官方文档,看不同的角色具体分配那些权限

GitLab中共定义了四种角色,每种角色各分配了不同的权限,如下表所示

我查找了Push to protected branches这一项,发现Developer是没有该权限的,所以导致无法push代码到远程仓库,只需项目所有者对该成员提权即可,重新邀请该成员,role permission选择Maintainer角色,如下图所示

Action Guest Reporter Developer Maintainer Owner
Download project ✓ (1) ✓ ✓ ✓ ✓
Leave comments ✓ (1) ✓ ✓ ✓ ✓
View Insights charts (ULTIMATE) ✓ ✓ ✓ ✓ ✓
View approved/blacklisted licenses (ULTIMATE) ✓ (1) ✓ ✓ ✓ ✓
View License Compliance reports (ULTIMATE) ✓ (1) ✓ ✓ ✓ ✓
View Security reports (ULTIMATE) ✓ (3) ✓ ✓ ✓ ✓
View Dependency list (ULTIMATE) ✓ (1) ✓ ✓ ✓ ✓
View License list (ULTIMATE) ✓ (1) ✓ ✓ ✓ ✓
View licenses in Dependency list (ULTIMATE) ✓ (1) ✓ ✓ ✓ ✓
View Design Management pages (PREMIUM) ✓ ✓ ✓ ✓ ✓
View project code ✓ (1) ✓ ✓ ✓ ✓
Pull project code ✓ (1) ✓ ✓ ✓ ✓
View GitLab Pages protected by access control ✓ ✓ ✓ ✓ ✓
View wiki pages ✓ ✓ ✓ ✓ ✓
See a list of jobs ✓ (3) ✓ ✓ ✓ ✓
See a job log ✓ (3) ✓ ✓ ✓ ✓
Download and browse job artifacts ✓ (3) ✓ ✓ ✓ ✓
Create new issue ✓ (1) ✓ ✓ ✓ ✓
See related issues ✓ ✓ ✓ ✓ ✓
Create confidential issue ✓ (1) ✓ ✓ ✓ ✓
View confidential issues (2) ✓ ✓ ✓ ✓
Assign issues   ✓ ✓ ✓ ✓
Label issues   ✓ ✓ ✓ ✓
Set issue weight   ✓ ✓ ✓ ✓
Lock issue threads   ✓ ✓ ✓ ✓
Manage issue tracker   ✓ ✓ ✓ ✓
Manage related issues (STARTER)   ✓ ✓ ✓ ✓
Manage labels   ✓ ✓ ✓ ✓
Create code snippets   ✓ ✓ ✓ ✓
See a commit status   ✓ ✓ ✓ ✓
See a container registry   ✓ ✓ ✓ ✓
See environments   ✓ ✓ ✓ ✓
See a list of merge requests   ✓ ✓ ✓ ✓
View project statistics   ✓ ✓ ✓ ✓
View Error Tracking list   ✓ ✓ ✓ ✓
Pull from Conan repository, Maven repository, or NPM registry (PREMIUM)   ✓ ✓ ✓ ✓
Publish to Conan repository, Maven repository, or NPM registry (PREMIUM)     ✓ ✓ ✓
Upload Design Management files (PREMIUM)     ✓ ✓ ✓
Create new branches     ✓ ✓ ✓
Push to non-protected branches     ✓ ✓ ✓
Force push to non-protected branches     ✓ ✓ ✓
Remove non-protected branches     ✓ ✓ ✓
Create new merge request   ✓ ✓ ✓ ✓
Assign merge requests     ✓ ✓ ✓
Label merge requests     ✓ ✓ ✓
Lock merge request threads     ✓ ✓ ✓
Manage/Accept merge requests     ✓ ✓ ✓
Create new environments     ✓ ✓ ✓
Stop environments     ✓ ✓ ✓
Add tags     ✓ ✓ ✓
Cancel and retry jobs     ✓ ✓ ✓
Create or update commit status     ✓ ✓ ✓
Update a container registry     ✓ ✓ ✓
Remove a container registry image     ✓ ✓ ✓
Create/edit/delete project milestones     ✓ ✓ ✓
Use security dashboard (ULTIMATE)     ✓ ✓ ✓
View vulnerabilities in Dependency list (ULTIMATE)     ✓ ✓ ✓
Create issue from vulnerability (ULTIMATE)     ✓ ✓ ✓
Dismiss vulnerability (ULTIMATE)     ✓ ✓ ✓
Apply code change suggestions     ✓ ✓ ✓
Create and edit wiki pages     ✓ ✓ ✓
Rewrite/remove Git tags     ✓ ✓ ✓
Manage Feature Flags (PREMIUM)     ✓ ✓ ✓
Use environment terminals       ✓ ✓
Run Web IDE's Interactive Web Terminals (ULTIMATE ONLY)       ✓ ✓
Add new team members       ✓ ✓
Enable/disable branch protection       ✓ ✓
Push to protected branches       ✓ ✓
Turn on/off protected branch push for devs       ✓ ✓
Enable/disable tag protections       ✓ ✓
Edit project       ✓ ✓
Add deploy keys to project       ✓ ✓
Configure project hooks       ✓ ✓
Manage Runners       ✓ ✓
Manage job triggers       ✓ ✓
Manage variables       ✓ ✓
Manage GitLab Pages       ✓ ✓
Manage GitLab Pages domains and certificates       ✓ ✓
Remove GitLab Pages       ✓ ✓
Manage clusters       ✓ ✓
View Pods logs (ULTIMATE)       ✓ ✓
Manage license policy (ULTIMATE)       ✓ ✓
Edit comments (posted by any user)       ✓ ✓
Manage Error Tracking       ✓ ✓
Delete wiki pages       ✓ ✓
View project Audit Events       ✓ ✓
Manage push rules       ✓ ✓
Switch visibility level         ✓
Transfer project to another namespace         ✓
Remove project         ✓
Delete issues         ✓
Disable notification emails         ✓
Force push to protected branches (4)          
Remove protected branches (4)          

 

posted @ 2020-02-25 10:01  野猿新一  阅读(634)  评论(0)    收藏  举报