jane27 发表于 2018-1-10 16:29:29

Gitlab的develop角色的人没有权限无法提交的问题解决方案

问题
  事情是这样的,最近跟几位同事搞一些东西,打算在Gitlab上建一个仓库,然后协同开发。
  我建好仓库,将其他几位同事添加进来,角色分配为Develop。
https://images2015.cnblogs.com/blog/746158/201512/746158-20151201140310015-1549627468.png
  之后提交初始代码到master分支后,他们用sourceTree拉取代码后进行开发,之后再提交时发现无法提交,提示没有权限。
https://images2015.cnblogs.com/blog/746158/201512/746158-20151201140310827-1353367579.png
  如下:
  错误提示:
  git -c diff.mnemonicprefix=false -c core.quotepath=false push -v origin master:master
  Pushing to http://xxx/xxx/xxx_HTML.git
  POST git-receive-pack (47642 bytes)
  remote: GitLab: You don't have permission[K
  To http://xxx/xxx/xxx_HTML.git
  ! master -> master (pre-receive hook declined)
  error: failed to push some refs to 'http://xxx/xxx/xxx_HTML.git'
解决方案
  研究了下Gitlab,最终解决方案是:
  在项目的【Setting】中的【Protected branches】可以设置哪些分支是被保护的,默认情况下【master】分支是处于被保护状态下的,develop角色的人是无法提交到master分支的,在下面的【Developers can push】打上钩就可以了。
https://images2015.cnblogs.com/blog/746158/201512/746158-20151201140312015-1975217861.png
  还可以对某个分支做单独设定,哪些分支可以被提交
https://images2015.cnblogs.com/blog/746158/201512/746158-20151201140312890-901064365.png
  (完)
  原文地址-http://www.cnblogs.com/xxcanghai/p/5009926.html
页: [1]
查看完整版本: Gitlab的develop角色的人没有权限无法提交的问题解决方案