問題描述
公司自己搭建的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) |