sudo gitlab-rails runner /tmp/script.rb

Category: GitLab

sudo gitlab-rails runner /tmp/script.rb

Run a Ruby script inside GitLab

Executes the script file in the GitLab Rails environment, letting you loop over records and call application code. Scripts run as the git user with full database access, so test them on a copy first. One-liners work too by passing the code as a string.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.