How using api gitlab to download file

I have tried this but it doesn’t work.


Cannot understand how using api to download with curl my file on gitlab.

here my url:


I have checked official website but cannot understand how it’s works and which part I should replace:

curl --request GET --header 'PRIVATE-TOKEN: ’ ‘

I have tried but it’s not working

curl --insecure --request GET --header ‘PRIVATE-TOKEN: Y_F8YP3nUnFbzhxkQvgo’ ‘https://gitlabxxxxxxxxxx/api/v4/administration/gitlab/98/src/main/script/deploiement/settings/rci/

My project ID is : 98 I would like to download this, I’am using gitlab-ce 12.6.4.

Thanks for help

I was able to download an archive of my code branch by using this command:

curl -k --header "PRIVATE-TOKEN: xxxx" https://gitlab.xxxxx/api/v4/projects/1389/repository/archive?sha=630bc911c1c20283d3980dcb95fd5cb75479bb9c -o myFilename.tar.gz

I got the SHA value from the webUI after selecting the branch I wanted from the pull-down and copying the value on the right for the SHA.


I hope that helps.


Thank you @frakman it helped me after 3-4 hours of trouble

1 Like