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 http://server.com/user/project/raw/master/file.make

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

curl http://server.com/user/project/raw/master/file.make

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

Is it possible?

解决方案

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)

For convenient I will use the https://gitlab.com as the example server.

Go to https://gitlab.com/profile/account and find your "Private token"

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

curl https://gitlab.com/api/v3/projects?private_token=

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

curl https://gitlab.com/api/v3/projects//repository/tree?private_token=

Finally get / run the file!

curl https://gitlab.com/api/v3/projects//repository/raw_blobs/?private_token=

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

drush make https://gitlab.com/api/v3/projects//repository/raw_blobs/?private_token=

(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.)

EDIT

You can get the file without the project_id by using the encoded project name. For example the my-user-name/my-project will become: my-user-name%2Fmy-project

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐