GitLab: Is there a way to protect a branch from command line?

こ雲淡風輕ζ 提交于 2019-12-10 18:15:30

问题


Am aware of how its done from the GitLab UI (http://gitlabdomain.com/ProjectNamespace/Project/protected_branches), but is there a way to "Protect" a particular branch from the command line?


回答1:


Sure, you need a third-party command-line tool for that though, or use the REST API directly yourself.

Check http://www.rubydoc.info/gems/gitlab/frames which is listed on https://about.gitlab.com/applications/




回答2:


You cant protect branch from the command line.

Git doesn't know how did you execute the command.
All the gui tools are executing git commands which are CLI behind the scenes.

So your answer is NO

What you can do might be able to pass special parameter along with the git lag commands -c flag to any command and then check it in your server hooks to verify that the command came from GUI and not from CLI.



来源:https://stackoverflow.com/questions/34509475/gitlab-is-there-a-way-to-protect-a-branch-from-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!