tvl tvl - 10 months ago 49
Linux Question

Open a file directly from a GitLab private repository

I have a private repository on a GitLab server and using the SSH I can pull a project using git clone.

But I want to run a script on linux command line directly from the server (more specific, a Drupal / Drush .make file)

I tried to run it using the raw file:

drush make

(for the convenience of non Drupal users let’s say)


Without success. Of course, it returns me the login page.

Is it possible?

tvl tvl
Answer Source

With Chris's valuable help, here is how you can run a script (drupal .make file in my case) from a GitLab server. (Probably it works for GitHub but I didn't test it. Maybe the syntax will be a bit different). (Of course this works for any type of script)

It can be done using the authentication tokens. Here is the documentation of the GitLab's API and here is the GitHub's API

For convenient I will use the as the example server.

  • Go to and find your "Private token"

  • Then print the list of the projects and find the id of your project you are looking for


    or go there with your browser (a json viewer will help a lot)

  • Then print the list of the files that are on this project and find the id of your file you are looking for


  • Finally get / run the file!


In case you want to run the script (drupal .make)

drush make<project_id>/repository/raw_blobs/<file_id>?private_token=<your_private_token> <drupal_folder>

(If you are here looking for a workflow to integrate GitLab with Aegir .make platforms without using tokens (maybe SSH?) please make a thread and paste here the link.)