János
János

Reputation: 35110

How to add server side hook to GitLab?

I would like to prevent execute a push on GitLab if someone before pushed an other commit. I would force him to pull first, then do an interactive rebase. I thought I need server side git hook.

I red tis article: https://docs.gitlab.com/ce/administration/server_hooks.html

but I stuck on this line: On the GitLab server, navigate to the project’s repository directory.

How can I log into GitLab? I installed gitlab-runner but I have no clue how to "Log In` and add the pre-receive script to the hooks subdirectory.

Do you have any idea?

Upvotes: 2

Views: 896

Answers (1)

VonC
VonC

Reputation: 1327784

Protecting the branch should be enough: that would prevent from force pushing to the branch.
And it can be set through GitLab GUI, without having to log on to the GitLab server.

That means: if someone already pushed, you will have to pull first, before being able to push yourself.

Upvotes: 1

Related Questions