Download a release asset archive from GitLab via curl redirects to login page
### Summary Im trying to download release from GitLab using curl but it keeps getting redirected to the signin page. How can I do this? I have tried the following with no luck: ``` curl --header "PRIVATE-TOKEN: XXXXXXXXX" "https://gitlab2.mydomain.com/group/project/-/archive/v0.0.5/test-v0.0.5.zip" ### Steps to reproduce ``` If I try to download tarball from release page, from UI it accessible with link https://gitlab2.mydomain.com/group/project/uploads/d52e8a2bf2a406face2f949d875504b9/test-v0.0.5.zip ``` curl --header "PRIVATE-TOKEN: XXXXXXXXX" "https://gitlab2.mydomain.com/group/project/uploads/d52e8a2bf2a406face2f949d875504b9/test-v0.0.5.zip" ``` I receive this: `<html><body>You are being <a href="https://gitlab2.mydomain.com/users/sign_in">redirected</a>.</body></html>` My Gitlab-CI version is 11.10.4 ## Preferred approach You can download the archive using the [get file archive](https://docs.gitlab.com/ee/api/repositories.html#get-file-archive) endpoint from the Repository API, you can specify a `sha` as a query parameter which can be a branch, tag or commit sha. ```sh $ curl --header "PRIVATE-TOKEN: ${GITLAB_PRIVATE_TOKEN}" \ "https://gitlab.com/api/v4/projects/27579160/repository/archive.zip?sha=v0.0.2" -o ./out/gitlab-v0.0.2.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1602 100 1602 0 0 4161 0 --:--:-- --:--:-- --:--:-- 4161 zipinfo out/gitlab-v0.0.2.zip Archive: out/gitlab-v0.0.2.zip Zip file size: 2628 bytes, number of entries: 5 warning [out/gitlab-v0.0.2.zip]: 1026 extra bytes at beginning or within zipfile (attempting to process anyway) drwx--- 0.0 fat 0 bx stor 21-Jun-21 11:06 release-test-v0.0.2-d10853040716a6a6cd408cdc0b3b818a261e785c/ -rw---- 0.0 fat 506 tx defN 21-Jun-21 11:06 release-test-v0.0.2-d10853040716a6a6cd408cdc0b3b818a261e785c/.gitlab-ci.yml drwx--- 0.0 fat 0 bx stor 21-Jun-21 11:06 release-test-v0.0.2-d10853040716a6a6cd408cdc0b3b818a261e785c/cmd/ -rw---- 0.0 fat 73 tx defN 21-Jun-21 11:06 release-test-v0.0.2-d10853040716a6a6cd408cdc0b3b818a261e785c/cmd/main.go -rw---- 0.0 fat 57 tx stor 21-Jun-21 11:06 release-test-v0.0.2-d10853040716a6a6cd408cdc0b3b818a261e785c/go.mod 5 files, 636 bytes uncompressed, 390 bytes compressed: 38.7% ``` Screenshots from private project ![Screen_Shot_2021-06-21_at_2.45.40_pm](/uploads/44e75113b7e9e4d990d830a04ed87fb9/Screen_Shot_2021-06-21_at_2.45.40_pm.png) ![Screen_Shot_2021-06-21_at_2.44.34_pm](/uploads/8340ad25dfed6ee8caa529386c8a4467/Screen_Shot_2021-06-21_at_2.44.34_pm.png)
issue