Pranesh Vittal
Pranesh Vittal

Reputation: 153

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

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?

Upvotes: 8

Views: 6997

Answers (2)

marcolz
marcolz

Reputation: 2970

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/

Upvotes: 2

CodeWizard
CodeWizard

Reputation: 142174

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.

Upvotes: 2

Related Questions