git - 无法将更改推送到管理员创建的分支
问题描述
所以我正在研究 Gitlab 。假装同时是管理员和合作者。
作为管理员:
推动项目
myslavebranch
使用网站上提供的按钮创建分支“ ”。
作为合作方:
$ git init
$ git config --global user.name "theslave"
$ git config --global user.email "theslave@gmail.com"
$ git remote add origin git@gitlab.com:theadmin/masterproject.git
$ git pull
$ git clone git@gitlab.com:theadmin/masterproject.git
是的,现在我将项目放入我的仓库中。修改文件,添加,提交。现在切换到分支
$ git checkout myslavebranch
$ git push
我得到了:
remote:
remote: ========================================================================
remote:
remote: You are not allowed to push code to this project.
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.
这里有什么问题?管理员需要先给权限吗?是关于 SSH 的吗?错误的步骤?我想将我编辑的版本推送到管理员创建的分支。我该怎么做?
解决方案
检查存储库的权限。
我认为您需要成为开发人员、维护人员或所有者才能推送代码。贡献者通常需要类似的配置才能将代码推送到存储库中。例如,在大多数情况下,管理员应该将用户添加到存储库中作为“开发人员”,或者更好的角色来推送代码。或者管理员允许任何人推送代码。
参考:https ://docs.gitlab.com/ee/user/permissions.html
其他故障排除包括检查您的 SSH 公钥是否已在 gitlab 中正确注册并与您的帐户相关联。
另外,请检查管理员创建的分支是否受到保护。
参考:https ://docs.gitlab.com/ee/user/project/protected_branches.html
推荐阅读
- excel - VBA - 在循环范围内搜索
- python - python键盘库中的ImportError
- amazon-web-services - AWS EC2 无需关闭并重新启动即可获得新的动态 IP
- sql - 在 Postgres 中从 JSONB 数据创建 NUMERIC 数组
- java - 如何在 Spring Boot 应用程序中添加两个上下文路径
- javascript - VueJS:是否可以将扩展运算符用于计算属性?
- python - 删除对象时是否可以在 django admin 中显示加载消息?
- npm - 如何使用 DefinePlugin 并尝试将其登录到控制台
- python - 文件编码 VS Code
- git - 使用动态参数创建 Git 别名