Sir Crow
Sir Crow

Reputation: 46

GitLab: How to filter bad formats?

I want to make sure users wont be able to push some formats. I would like to check the file format before uploading the file to the GitLab server. the Web Hooks affects only the specific project, while I want the whole server be filtered. Any idea?

Upvotes: 1

Views: 41

Answers (1)

Sir Crow
Sir Crow

Reputation: 46

Ok, found out what to do. I used Hooks. you can add your own script inside this path:

/opt/gitlab/embedded/service/gitlab-shell/hooks/

you can edit the existing samples. I wrote in Ruby and another script in Bash, just make sure you add "#!/bin/bash" (or whatever script language you write) to the file header. make sure you bring the file CHMOD 755 or higher, and the file name should be the event name (without any format, just "pre-rereceive" for example).

notice that you get some parameters, you can read in "pre-receive.sample" notes. Good luck.

Upvotes: 1

Related Questions